Link to home
Create AccountLog in
Avatar of sqlprg

asked on

Datetime data type conversion error ASP on IIS 7 when inserting date to SQL server 2005

When inserting  a date to SQL server 2005 DB table datetime data type column from an ASP page running on IIS7 the following error occurs

Microsoft SQL Native Client error '80040e07'  The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.

This error does not occur when the ASP page is running on IIS6

Can you please help to resolve the issue
Avatar of HainKurt
Flag of Canada image

post the code
Avatar of cyberkiwi
There may be some regional date format handling that is different between the servers (more likely) or iis versions (less).

To be completely portable, always format the date as YYYYMMDD (no dashes, just 8 digits) or use parameters (recommended).
Avatar of sqlprg


Thanks, cyberkiwi

for instance how do you insert a value that is returned by the  ASP  now() function which will have the date and time in it?
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
great post from angelIII. are you working for EE angel?
Avatar of sqlprg


Grate !  Works fine,  Thanks,  appreciate it
Avatar of sqlprg


Grate !  Works fine,  

Thanks angelIII,  

appreciate it