Here's my query:
string sql = @"INSERT INTO MY_TABLE(DATE)
VALUES (convert(datetime, '{0}')";
sql = string.Format(sql, myDate);
myDate is a C# DateTime object and has this value before the string.format:
MY_TABLE has a DATE column as a DateTime type.
I got this error:
The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.
I need to store the myDatevalue in a format like: 31/12/2013 23:59:00 into MY_TABLE.
thanks in Advance
shreesh chandra shukla
16-Jul-2013better to use sql parameters
add the parameter to your SqlCommand