Article View: borland.public.cppbuilder.database.ado
Article #1829Re: Best way to set a date/time field
From: Viatcheslav V. Vassiliev
Date: Tue, 10 Feb 2004 17:33
Date: Tue, 10 Feb 2004 17:33
36 lines
2234 bytes
2234 bytes
Use parameter
UPDATE TableName SET FieldName=?
Q.Parameters[0].Value = Now();
//------------------------------------------
Regards,
Vassiliev V. V.
http://www.managed-vcl.com - using .Net objects in Delphi for Win32 +
ADO.Net
http://www.oledbdirect.com - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)
"Steve Aletto" <steve_alettoNOSPAM@THANKShotmail.com> �������/�������� �
�������� ���������: news:402905f6$1@newsgroups.borland.com...
> Hi all,
>
> I'd like to know what's the best way to set a date/time field in a
database.
> I thought the following was quite good (Q is a TADOQuery *):
>
> Q->SQL->Add("UPDATE TableName SET FieldName=" + String(double(Now())));
>
> But that's not true: with SQL server you should substract 2, furthermore
> comma must be substituted with dot (it depends on the international
settings
> of the PC though) and maybe some other bugs are behind the corner. I found
> many problems/differences handling the date/time field as a string, too.
>
> So, I'm looking for a sure and standard (same for many databases) way to
> achieve this simple job. Thanks for any hint.
>
> Steve.
>
>
Technical Details
Message-ID:
<402915e9$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!fr.ip.ndsoftware.net!newshosting.com!nx02.iad01.newshosting.com!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<402905f6$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: 10698b,55d7527b38e6f972 X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2004-02-10 09:35:05 PST From: "Viatcheslav V. Vassiliev" <support@oledbdirect.com> Newsgroups: borland.public.cppbuilder.database.ado References: <402905f6$1@newsgroups.borland.com> Subject: Re: Best way to set a date/time field Date: Tue, 10 Feb 2004 20:33:26 +0300 Lines: 38 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 NNTP-Posting-Host: 213.234.218.42 Message-ID: <402915e9$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1076434409 213.234.218.42 (10 Feb 2004 09:33:29 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!fr.ip.ndsoftware.net!newshosting.com!nx02.iad01.newshosting.com!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail