
Slopey
Posts: 33
|
| Posted: 03/14/2007, 1:05 PM |
|
Anyone else come across a problem using the Connection.toSQL method for datetime fields with SQL Server 2005?
I used Connection1.toSQL(Now,ccsDate) previously with an SQL Server 2000 database without any issues, but now I've upgraded to SQL Server 2005, I always get "The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value. (Microsoft SQL Native Client)".
I can work around it by converting the date into a more acceptable ISO format string for SQL Server, but it's hell of an annoying.
Anyone come across it?
S.
|
 |
 |
Benjamin Krajmalnik
|
| Posted: 03/15/2007, 11:44 PM |
|
I prefer to use CCToSQL.
Are you trying to use a date or datetime?
The safe way would be to use the CCFormatDate() function.
I prefer to pass the dates as array("yyyy","mm","dd") (note n separators)
since this makes it locale independent, whereas the standard with the "-"
delimiters can cause a problem if the database loclization is different than
the web server's.
"Slopey" <Slopey@forum.codecharge> wrote in message
news:645f863ac4c6da@news.codecharge.com...
> Anyone else come across a problem using the Connection.toSQL method for
> datetime
> fields with SQL Server 2005?
>
> I used Connection1.toSQL(Now,ccsDate) previously with an SQL Server 2000
> database without any issues, but now I've upgraded to SQL Server 2005, I
> always
> get "The conversion of a char data type to a datetime data type resulted
> in an
> out-of-range datetime value. (Microsoft SQL Native Client)".
>
> I can work around it by converting the date into a more acceptable ISO
> format
> string for SQL Server, but it's hell of an annoying.
>
> Anyone come across it?
>
> S.
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
 |
|

|
|
|
|