I have a table with the field end_date which is defined as a smalldatetime.
I have been unable to update this field using the SqlCommand object.
In my windows form I have a DateTime Picker and I am trying to get it's value into the db with no success.
I have tried
command.Parameters.Add ("@.end_date",SqlDbType.DateTime);
command.Parameters["@.end_date"].Value = dtpEndDate.Value;
I have also tried variations of
command.Parameters.AddWithValue ("@.end_date",dtpEndDate.Value);
Please assist if you can.
although I don't believe this is the best way, but it's working.
command.Parameters.AddWithValue("@.end_date", dtpEndDate.Value.ToShortDateString());
No comments:
Post a Comment