[thelist] ASP - SQL Date Time Help

Michael Pack michaelpack at wvdhhr.org
Wed Aug 4 10:50:32 CDT 2004


Hi all, I'm having a problem inserting an empty value into a datetime
field in SQL Server 2000 database. The field is not required in the form
so I must allow for NULL.

I am concatenating my string as follows

if request.Form("income_no_end_month") = "" &
request.Form("income_no_end_day") = "" &
request.Form("income_no_end_year") = "" then
strincome_no_enddate = ""
else
strincome_no_enddate = request.Form("income_no_end_month") & "/" &
request.Form("income_no_end_day") & "/" &
request.Form("income_no_end_year")
end if

I have the SQL Database field set to accept NULLS, it is a datetime
field. 

I keep getting the following error when I run the transaction without
selecting an end date in the form:

Microsoft OLE DB Provider for SQL Server (0x80040E07)
The conversion of a char data type to a datetime data type resulted in
an out-of-range datetime value.

I've done a response.Write for the string and it is empty.

Any assistance is greatly appreciated.

MP


More information about the thelist mailing list