i am trying to make INSERT command to my SQLEXPRESS db and recieve error while trying to enter a value to my DateTime column.
this is the sql command i use:
SqlDateTime sTime = new SqlDateTime(book.PublishedDate);
string sql = string.Format("Insert into Books" +
"(Name, PublishDate, IsInternal) Values" +
"('{0}', '{1}', '{2}')",
book.Name, sTime.Value, book.IsInternal);
book.PublishedDate - is DateTime type and the PublishedDate column is sql DateTime
i recieve the following error: The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.
how can i resolve that ?