Date Time updating

Hello,

I have a problem with updating a field in one of my data tables.
It is a datetime field -
On one of my pages there is an update where the user fills in the date for scheduling purposes. there is another date field that is for a completion date. the second textbox is usually going to be left blank on the first update.
When the update takes place the completion date fills in the table a date that is
1/1/1900 12:00:00 AM
I want to avoid this and keep the field in the table blank or null.
How can this be done to avoid the 1900 date.
Thanks
E
0
Hadware
10/24/2003 5:42:28 PM
asp.net.sql-datasource 29906 articles. 0 followers. Follow

3 Replies
332 Views

Similar Articles

[PageSpeed] 6

You can avoid the 1900 date by using System.DBNull.Value as your parameter value.

Terri
Terri Morton
Engagement Manager, Neudesic

How to ask a question

0
tmorton
10/24/2003 6:48:10 PM
Hi Terri,

where at??
I have : "sproc '" & somevalue & "', '" & someothervalue & "', '" & differentonehere &_
"', '" & onemorevalue & "'"
Create sproc
(@param1 Varchar(25),
@param2 Varchar(512),
@param3 Varchar(15),
@param4 Varchar(15))
AS
.....
Passing param1 as a name or something
param2 as a long description of something
param3 and param4 as a date into a datetime column
So if the value passed to the param3 or param4 is empty,
where do I put the System.DBNull.Value at?
Eric
0
Hadware
10/25/2003 1:53:02 PM
This is the key right here: "So if the value passed to the param3 or param4 is empty"

You don't want to pass them as empty. You want to pass them as System.DBNull.Value from your ASP.NET page.
I wouldn't sugget calling your stored procedure as you are -- look at how to use Parameters on your Command object to pass your values. Look here for info on that: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/bdadotnetdata1.asp
Terri


Terri Morton
Engagement Manager, Neudesic

How to ask a question

0
tmorton
10/25/2003 6:12:02 PM
Reply: