Click here to Skip to main content
15,889,281 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Actually i created one ERP project...it's complaint management system based...while some inserting the values in my asp.net page i getting this conversion of a varchar data type to a datetime data type resulted in an out-of-range value error...but for this error i made changes in sql server i change into login---->ONDEMAND\bench(user) i change the language into dutch..its getting clear now...but while i putting reports i getting same error....so again i change into dutch---->english means i can get clear but again stuck on the first one????

How to solve this problem????
Posted

When you change language in software you're often changing more that just the language.

You are telling the software to conform with the culture of that language.

This means that the way dates are written change.

en-GB has a date formation of dd/MM/yyyy
en-US has a date formation of MM-dd-yyyy

Not only are the delimiters different but the order of the date components changes too.

So where as an input of 13/11/2013 would work for a en-GB culture. This would throw an exception for the en-US culture as there's no 13th month in the year.

Check the date culture for your desired language and ensure date inputs match the expected format for that culture.

Failing that, always try and convert to a UTC date format before providing the date to SQL.
 
Share this answer
 
Use this

Format(Now, "yyyy-MM-dd")--- in vb.net code
Strings.Format(DateAndTime.Now, "yyyy-MM-dd")--- in C#
 
Share this answer
 
Comments
Member 12521230 19-Sep-17 7:50am    
The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900