Wednesday, 15 September 2010

c# - Error inserting date values into database -



c# - Error inserting date values into database -

i having weird problem inserting date value database. when debugging program, realized inserts first 5 rows database on 6th throws exception. verified if syntax error or if changed along way checking first 5 queries execute 6th , both same. if there problem type, should throw exception beginning. think?

this error get

the conversion of char info type datetime info type resulted in out-of-range datetime value.

the conversion of char info type datetime info type resulted in out-of-range datetime value.

that suggests you're specifying value string, , performing conversion. don't that. avoid string conversions wherever perchance can. (i suspect there's quite perchance disconnect between string format you're providing , 1 that's beingness used parsing. removing string conversion best prepare this.)

instead, provide value sqlparameter datetime value.

c# sql sql-server visual-studio-2010

No comments:

Post a Comment