Link to home
Start Free TrialLog in
Avatar of garethtnash
garethtnashFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Microsoft OLE DB Provider for SQL Server error '80040e07'

Hi there,

I'm getting the following error on a submit page asp -

Microsoft OLE DB Provider for SQL Server error '80040e07'

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

/checkout.asp, line 179

the data that is being sent is in dd/mm/yyyy format, when I try and change the code on the page I get another error, so ideally as a short term I would like to capture this and do the conversion on the database (ms sql) anyway of doing this?

thanks
Avatar of Blackninja2007
Blackninja2007

usually beacuse server is expecting mm/dd/yyyy and not dd/mm/yyyy.

Hope that helps
Avatar of garethtnash

ASKER

is there a way to change this code -
<input type="text" value="dd/mm/yy" onfocus="this.select();lcs(this)" onclick="event.cancelBubble=true;this.select();lcs(this)">
So that it inputs like -
October 24 2008 ?
Thanks
i am not sure if i understand what are you trying to say but
you could use 3 dropdown menus with days, months, years
let user select the date
myStr= request.form("month") & "/" & request.form("day") & "/" & "/" & request.form("year")

and use cDate(myStr) that you send to mssql.
I would recommend using either a date picker control or seperate combo's for each date part.
ASKER CERTIFIED SOLUTION
Avatar of Steve Krile
Steve Krile
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
But...as a warning, the other commenters are correct...handling date formats by the time it gets to SQL can be quite fragile.  Your interface really should handle all the formatting issues, and once you are submitting your data to SQL everything should be *strongly* typed.
thank you