ASP.NET - SQL database

  • Thread starter Thread starter Ashoo
  • Start date Start date
A

Ashoo

I am trying to insert a record into my dataset with a
blank date from a textbox.text control feild. I keep
getting an error saying that it can not convert string ""
to date type. Could anyone help?

Thanks
 
I don't think you can insert an empty string into a date field. (From your
error I'm guessing it's a data field in the database.) If the column allows
nulls, you can enter a null value, or you must enter a date in an acceptable
format to be recognized as a date.

-Darrin
 
Hi,

Since empty string cannot be converted into actual date, ADO .NET throw an
exception. What you need to do here is to check if this is an empty string
then assign DbNull value to the column
 
Since the textboxt.text that should contain the date value
is blank, I tried to assign dbnull to the date column as
bdnull.value. But ASP.NET still rejected it.... saying it
can not convert dbnull type to date type. Even though the
collumn is set to allow nulls value. Did I assign it
right? any other ideas...Thanks
 
Back
Top