Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 blank string for DateTime field?

Author  Topic 

picardBP
Starting Member

1 Post

Posted - 2009-09-18 : 17:41:20
I have a website that is partially in classic ASP and partially in ASP.Net. (We have it set up so that there is a shared session between classic ASP and ASP.Net).

I've recently discovered that in the classic ASP code, when you assign a blank string to a DateTime field of a recordset and call Update(), it saves the value "12/30/1899" in the database.

I made a .Net test page where I updated a DateTime DB field with a blank string, and it saved "1/1/1900" in the DB.

I am trying to locate all the places in the code that generate a value of "12/30/1899" in the DB. Has anyone ever unintentionally saved "12/30/1899" to a DateTime DB field using ASP.Net? If so, how did it happen?

Thanks!

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-09-19 : 03:01:34
Note that Empty string is actually converted to the default date value
It is 1900-01-01 for SQL Server and 1899-12-30 for Access and front ends
Instead of emty string you should pass NULL value

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -