It seems like, in my scouring of the net, that this is a common problem with SQL servers. My question is, how do i fix it?
I have a simple insert statement that does exactly what it is supposed to do...insert values that are input in text boxes. Some of those text boxes of course, are date fields that do not *need* to be valued. So, as most of you know, if a date is not entered into a datetime field, SQL defaults it to 01/01/1900.
I haven't found a simple and/or conclusive way to combat this.
Below is my sql string. Pretty simple and straightforward. No joins or anything...
Dim myInsertLabs as String = "INSERT INTO tblPatient_Values (pt_id, visit_date, appt_date, dre_date," & _
"lipid_prof_date, hgba1c_date, total_chol, hdl, ldl, triglycerides, hgba1c, values_comments1)" & _
"VALUES ('"& patient_id.text & "', '"& visit_date.text & "', '"& appt_date.text & "', '"& dre_date.text & "', " & _
"'"& lipid_prof_date.text & "', '"& hgba1c_date.text & "', '"& total_chol.text & "', '"& hdl.text & "', '"& ldl.text & "', " & _
"'"& triglycerides.text & "', '"& hgba1c.text & "', '"& value_comments1.text & "')"
Again, if the user does not enter a date, how can i make it so the SQL server DOES NOT put a 01/01/1900 in the field?? Besides changing the datatype on the SQL side.
Thanks for any help.
dc~
I have a simple insert statement that does exactly what it is supposed to do...insert values that are input in text boxes. Some of those text boxes of course, are date fields that do not *need* to be valued. So, as most of you know, if a date is not entered into a datetime field, SQL defaults it to 01/01/1900.
I haven't found a simple and/or conclusive way to combat this.
Below is my sql string. Pretty simple and straightforward. No joins or anything...
Dim myInsertLabs as String = "INSERT INTO tblPatient_Values (pt_id, visit_date, appt_date, dre_date," & _
"lipid_prof_date, hgba1c_date, total_chol, hdl, ldl, triglycerides, hgba1c, values_comments1)" & _
"VALUES ('"& patient_id.text & "', '"& visit_date.text & "', '"& appt_date.text & "', '"& dre_date.text & "', " & _
"'"& lipid_prof_date.text & "', '"& hgba1c_date.text & "', '"& total_chol.text & "', '"& hdl.text & "', '"& ldl.text & "', " & _
"'"& triglycerides.text & "', '"& hgba1c.text & "', '"& value_comments1.text & "')"
Again, if the user does not enter a date, how can i make it so the SQL server DOES NOT put a 01/01/1900 in the field?? Besides changing the datatype on the SQL side.
Thanks for any help.
dc~