I have a date field in my database (StartDate). I have created a datatable which will access this field. The DataType in the DataTable is defined as System.DateTime. Allow DBNull is set to True and th DefaultValue is <DBNull>. I have an SQL statement to add (INSERT) a new record. I have created a parameter to be used with the SQL statement. In the parameter options I have set AllowDBNull to true, the DbType is set to Date and the ProviderType is DBDate. Everything works great as long as the date textbox has a date in it. The problem is there is not always a date provided to a DBNull value should added. When I try to run the SQL statement with no date provided I get the following error message:
Conversion from string "" to type 'Date' is not valid.
I have tried many things but cant seem to get rid of the error.
Thanks for any help,
Randy