ADO Datetime field

Post Reply
User avatar
Rick Lipkin
Posts: 2397
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

ADO Datetime field

Post 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
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Post 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
Regards

G. N. Rao.
Hyderabad, India
Post Reply