Page 1 of 1

ADO Datetime field

Posted: Wed Jun 20, 2007 8:09 pm
by Rick Lipkin
To All

How do I concantonate date()+time() into a datetime field to SQL server with ADO ??

The reason to add the time stamp is because SQl server does not respect 'natural order'. When I have multiple entry's on the same date() .. SQL will order them randomly within the same date and not as they were added to the table by date .. however if I add the Time() aspect to the datetime field .. the records sort in order of actual sequence.

Rick Lipkin
SC Dept of Health, USA

Posted: Fri Jun 22, 2007 2:55 am
by nageswaragunupudi
Convert date and seconds into a double value like this and assign the value. Date field in OLE can be assigned a value as date or double

Code: Select all

nDateTime := ( dDate - CTOD("")) + (nSeconds/(24*3600))
oRs:Fields("datetimefield"):Value := nDateTime
This works for all OLE applns, with win32ole.prg of xHarbour. Thiis is working me for Excel and Oracle. Should work for MSSql also.

Regards