TechArena Community

TechArena Community (http://forums.techarena.in/)
-   Software Development (http://forums.techarena.in/software-development/)
-   -   out-of-range datetime value (http://forums.techarena.in/software-development/1256451.htm)

MobilePhoneGuru 09-10-2009 09:43 AM

out-of-range datetime value
 
Hello,
I am writing web application. It was working fine with no errors in my local server and the live server. My system lost its data and the hard drive got corrupted. So my hard drive was replaced with a new one. When I configure the web application on my new hard drive and run it, it was working ok except for the part that is has date selection on it I get the following error
Exception Type: System.Data.SqlClient.SqlException.

I have not change the code or anything; the same version is working on the live server with no issues. I don?t know why it is giving me this error in my machine?? Any Suggestion??

JonathanD 09-10-2009 09:51 AM

Re: out-of-range datetime value
 
first of all Check your database properties. check for changes has been made wrongly.Pull the date is char versus datetime. Check your regional settings. For example, if you're trying to pass a date in UK format and the server is trying to interpret it in US format, you will either see this error or the wrong date in your database.Check for locale mismatch between the front end and back end. This typically happens if you have the front end (the Web server) and the back end (the data server) running on entirely separate machines.

Raine 09-10-2009 09:55 AM

Re: out-of-range datetime value
 
check your local setting .May be the locale settings for the server may be wrong. When you configure Windows Server (and in turn SQL Server) for a specific locale, the formatting of dates and times are inherited automatically from those settings. If the locale settings don't match the data being passed to the server -- for instance, if dates are passed as MM/DD/YYYY when they should be DD/MM/YYYY -- then the error will result. It can also happen if you're trying to import data from a source where the date formatting clashes with your locale settings.

Glenny 09-10-2009 10:05 AM

Re: out-of-range datetime value
 
This problems arise every time, You have to Create SqlParameter objects for the parameters.And after that add them to the Parameters collecion of the command.The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value. System.Data.Common.DbDataAdapter.FillFromReader(Object data, String srcTable, IDataReader dataReader, Int32 startRecord, Int32 maxRecords, DataColumn parentChapterColumn, Object parentChapterValue) +260. Check for your local setting and make them correct.


All times are GMT +5.5. The time now is 05:54 PM.