ADO Datetime field

ADO Datetime field

Postby Rick Lipkin » Wed Jun 20, 2007 8:09 pm

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
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Postby nageswaragunupudi » Fri Jun 22, 2007 2:55 am

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 62 guests