Saturday, August 29, 2009

The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.

SQL Date format is yyyy-mm-dd so so query will be
string mydate="10/04/2009";

datetime dt=convert.todatetime(mydate) ;

insert into mydatetime(mydatetime)values('"+ string.Format("{0:yyyy/MM/dd}",dt) +"')


it will work well .

No comments:

Post a Comment