I'm trying to insert in my database (SQL Server 2012) a date (dd/MM/yyyy) from a DateTimePicker. When I checked my database, the format has been saved like (yyyy/dd/MM), the problem is when I choose a day between 13 and the last day of the month, I got the message "error converting data type varchar to datetime". But if I choose a day between 01 and 12, it works.
My class is something like this:
public class Example
{
private SqlDateTime date;
public SqlDateTime date
{
get {return date;}
set {date = value;}
}
}
And the object that is getting my date is:
Example example = new Example();
example.date = SqlDatime.Parse(dateTimePicker.Value.Date);
My query just takes the (example.date) and insert it in the database. Any idea?
Thanks in advance, and sorry about my english