I'm building an ASP.NET website and I'm getting this error when I try to update a table using a standard sqldatasource and detailsview:
"Cannot insert the value NULL into column 'startdate', table 'kcsportal.dbo.projects'; column does not allow nulls. UPDATE fails. The statement has been terminated."
Bear with me while I explain how my ASP.NET website works:
1) There is a main page which is designed to edit a single record in the "projects" table. It has this hierarchy of controls inside it:
EditItemTemplate (for "startdate" field)
The idea is a SqlDataSource selects a single record from the Projects table. It's "updatequery" and "selectquery" have both been filled in.
The formview uses this sqldatasource to show summary info about the project, such as it's name, number of subprojects/tasks/billed hours etc.
The detailsview uses the sqldatasource as well. It is used to show all the fields in the projects table, as well as edit them, or delete the entire record.
Inside the detailsview, I have a date field called "startdate". I have created an edititemtemplate for when the record is being updated.
Inside the edititemtemplate is a webusercontrol called Field_DateField.aspx.
The WebUserControl references a .DLL that I am using to show a nice looking date picker. It is this one here: http://www.codeproject.com/KB/cpp/dwDatePickerArticle.aspx
So obviously somewhere along the line, the value gets lost before it makes it's way to the parameter in the updatecommand for the sqldatasource. But where? How do I find out?