R
Ronald S. Cook
I'm new to LINQ (to SQL) and just doing a simple insert.
This works fine:
_Diagnosi.DiagnosisName = DiagnosisNameTextBox.Text.Trim();
_Diagnosi.DiagnosisDescription = DiagnosisDescriptionTextBox.Text.Trim();
_Diagnosi.DiagnosisCreated = System.DateTime.Now();
COWFeedyardDataClassesDataContext dc = new
COWFeedyardDataClassesDataContext();
dc.Diagnosis.InsertOnSubmit(_Diagnosi);
dc.SubmitChanges();
However, I have default constraints on my database that will take care of
inserting the appropriate date, so I would like to not have to pass it in
each time. BUT, if I don't have that DiagnosisCreated line, then #12:00:00
AM# will be passed.
The result is error: "SqlDateTime overflow. Must be between 1/1/1753
12:00:00 AM and 12/31/9999 11:59:59 PM."
How can I not have to pass a date/time from the client in every instance?
Thanks very much for any assistance,
Ron
This works fine:
_Diagnosi.DiagnosisName = DiagnosisNameTextBox.Text.Trim();
_Diagnosi.DiagnosisDescription = DiagnosisDescriptionTextBox.Text.Trim();
_Diagnosi.DiagnosisCreated = System.DateTime.Now();
COWFeedyardDataClassesDataContext dc = new
COWFeedyardDataClassesDataContext();
dc.Diagnosis.InsertOnSubmit(_Diagnosi);
dc.SubmitChanges();
However, I have default constraints on my database that will take care of
inserting the appropriate date, so I would like to not have to pass it in
each time. BUT, if I don't have that DiagnosisCreated line, then #12:00:00
AM# will be passed.
The result is error: "SqlDateTime overflow. Must be between 1/1/1753
12:00:00 AM and 12/31/9999 11:59:59 PM."
How can I not have to pass a date/time from the client in every instance?
Thanks very much for any assistance,
Ron