Hello All,
My problem is simple I have a birthdate column of type
date
in my sql database and in my application I use dateTimePicker to get the birthdate, but when trying to insert the date I got from the dateTimePicker I get an error
Incorrect syntax near '12'
And when I try to debug the code I find that the value I get from the dateTimePicker is Date = {7/16/2011 12:00:00 AM}
the CODE:
cmd.CommandText="INSERT INTO person (birthdate) VALUES("+dateTimePicker.Value.Date+")";
con.Open();
cmd.ExecuteNonQuery();
con.Close();
Thanks in advance
:-)