This is a migrated thread and some comments may be shown as answers.

Saving date from DatePicker to sql server

1 Answer 260 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Clive Hoggar
Top achievements
Rank 1
Clive Hoggar asked on 22 Nov 2009, 05:24 PM
I am having trouble saving a date from the date picker, and it seems that this is the line 
causes a syntax issue:

objCommand.Parameters.Add("@SermonDate", SqlDbType.DateTime).Value = RadDatePicker1.SelectedDate.Value
 
The database column type is DateTime (but I also tried just Date)

I have tried a few variations on this code but I still get the error message "syntax error' near 'SermonDate'" .
There always seem to be issues when it comes to saving a date in a database!

What am I doing wrong!

Thanks

Clive




1 Answer, 1 is accepted

Sort by
0
Clive Hoggar
Top achievements
Rank 1
answered on 22 Nov 2009, 06:04 PM
OK problem solved. In fact it was a missing "," after the previous parameter that I just did not spot!

Clive
Tags
Calendar
Asked by
Clive Hoggar
Top achievements
Rank 1
Answers by
Clive Hoggar
Top achievements
Rank 1
Share this question
or