Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Null display as 1/1/1900 3

Status
Not open for further replies.

krizsy

Technical User
Apr 28, 2004
11
US
I am still having my nullable smalldatetime fields displaying as 1/1/1900. I have many date fields that I don't want anything in. This is on a web based form with asp. I am not sure what to type or where.
 
In the table design, have you removed the default value?
Shal
 
When inserting into the database the values submitted by the form. Force to insert null when the date field submitted on the form is empty. Something like this:

If request("mydate")="" Then

SQL= Insert Into Tablename(MYdate) Values (NULL)

Else
SQL= Insert Into Tablename(MYdate) Values ('"&request("mydate")&"')

End if

Then you will have NULL entered in the database instead of the default value 1/1/1990


hope that helps

VJ
 
I mean default value 1/1/1900 will be entered into the database when the date field on the form is empty.

VJ
 
datetimes are held as number of days from 1 jan 1900. You are inserting 0 into the field instead of null.
In your asp code you are sending 0 to the database instead of null. You either need to change the asp code to send a null or when you retrive data display 1 jan 1900 as blank.

Almost certainly not a problem with sql server.

======================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top