PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → MSSQL - date and time
MSSQL - date and time
Débuté par guest, 24 déc. 2008 11:51 - 1 réponse
Posté le 24 décembre 2008 - 11:51
Hi, i want to update a datetime-field in a mssql database.
If I update fields directly, I can just use
myTable.myField = DateSys+TimeSys
HModify(myTable)
To speed things up, when updating many records, I want to use HExecuteQuery().
I made a simple update-query and use a parameter for the field I want to update.
myQuery.Param1 = DateSys+TimeSys
HExecuteQeury(myQuery)
This will give me an error!! "Conversion failed when converting datetime from character string".
Do i need pre-format the query-parameter?
I'm using WD12 and OLEDB.
Arie
Posté le 29 décembre 2008 - 15:27
A safe format string to pass to SQL Server to populate a datetime field is:
'YYYY-MM-DDTHH:MM:SS'
Note the "T" between the date and time.
Kevin