I am performing an insertion of a new row from an ASP form into a database on my server.
When I look at the entries in the server, it looks as though they are in fact adding but it does stop all function at the execute line:
With
.Parameters(@blahblah) = Request.Form("blahblah")
.Parameters("@lastUpdate") = Now()
...
.Execute
End With
These are the errors I get:
Microsoft OLE DB Provider for ODBC Drivers 80040e07
[Microsoft][ODBC SQL Server Driver][SQL Server]The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value./results.asp217
The entries that are added have the dates in the column as:
2011-11-28 15:52:13.000
I have a feeling it is the milliseconds which I was under the impression only appears when using DateTime2 SQL field.
A few things I’ve tried after researching with no luck:
- Adding ‘Session.LCID = 2057’ – some SQL servers have British or US settings, this overrides the users settings
- Trying a bunch of different date formats such as FormatDateTime(Now(), 0 – 5)
- I can use ‘On Error Resume Next’ but I would prefer to rectify properly.
Any help is appreciated.
Without your additional information I would do it this way:
The best approach (if it’s possible) would be leave updating the
lastUpdatefield to trigger on the database.