ADO Date time update SQL Server

ADO Date time update SQL Server

Postby Rick Lipkin » Thu May 22, 2008 9:47 pm

To All

How can I convert date() to a datetime field in MS Sql server .. I was given this formula and it does work but does not insert the correct
date into the date portion of the field ..

nDateTime := ( DATE() - CTOD("") )+( SECONDS()/ (24*3600)) equals
something like 6/19/8620 5:17:14 PM

As you can see .. todays date is 05/22/2008 5:17 PM ..

I have records sorted by date desc and SQL server does not take into account natural order .. when you insert DATE() into a datetime field you get 5/22/2008 12:00 PM .. and if you have two rows with the same date .. I can not descriminate the time since both have the same 'default' time.. I need to be able to insert the date and time into the datetime fields to make the rows sort correctly.

Any advice or help would be appreciated BIG-TIME !!

Rick Lipkin
SC Dept of Health, USA
User avatar
Rick Lipkin
 
Posts: 2666
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Postby sysctrl2 » Thu May 22, 2008 10:43 pm

Rick,

esto es un error grave de xharbour ,

ADO solamente devuelve la FECHA

dejando fuera la hora,

este tema ya se habia mensionado en mensajes anteriores,

pero nadie ha dado una solucion,

saludos..
Cesar Cortes Cruz
SysCtrl Software
Mexico

' Sin +- FWH es mejor "
User avatar
sysctrl2
 
Posts: 1022
Joined: Mon Feb 05, 2007 7:15 pm

Postby Rick Lipkin » Thu May 22, 2008 11:00 pm

Rick,

this is a serious error of xharbour,
ADO only returns the DATE
leaving was the hour,
this theme already itself habia mensionado in previous messages,
but nobody has given a solucion,

Greetings..



I seem to have run into that 'brick wall' .. will do some more searching ..

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

Postby Eugeniusz Owsiak » Fri May 23, 2008 9:12 am

Rick,

Code: Select all  Expand view  RUN
set date american
set century on
...

oRs:Source := "Update <your table> set <your datetime field> = '"+;
dtoc(date())+" "+time()+"' where ......"
...
oRs:Open()


This update work for me and i get a proper datetime value in table.
Maby I don't understand your problem. If so - sorry.

Regards Eugeniusz
User avatar
Eugeniusz Owsiak
 
Posts: 60
Joined: Fri Oct 07, 2005 5:38 am
Location: Poland

Postby Rick Lipkin » Fri May 23, 2008 1:34 pm

Eugeniusz Owsiak

* dtoc(date())+" "+time() * .. WOW, that worked !!!!!!!!!!!!! beating my head against the wall here over something so simple.

Glad you had a better pair of eyes than I did ..

Thanks for the HELP !!

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

Postby nageswaragunupudi » Thu May 29, 2008 1:23 pm

If you are using xHarbour, you can straighaway use datetime.

dtDate := DateTime()
oRs:Field(x):Value := dtDate

Now xHarbour can handle date and time together, it is no more necesssary for us to handle date and time separately
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10651
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 71 guests