I am using an MS Access Database but this question also pertains to SQL Server as well.
I have a date field in the database which is not required, as sometimes a date is not needed. So in my code I have something like this:
protected void InsertDate()
DateTime _dateUpdated // create DateTime Variabble
if(txtUpdateDate.Text == "")
_dateUpdated = null;
_dateUpdated = Convert.ToDateTime(txtUpdateDate.Text);
basically what I am trying to get across is that when I try to assign a null value to DateTime I get an error. I want to know the best method to pass a null value to an insert query to have it insert a null value for a Date Field. I am sure this is a common occurance but it is the first time I have had to actually deal with it.