🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.ado
Article #1737

Re: Best way to set a date/time field

#1737
From: Viatcheslav V. Vassiliev
Date: Wed, 11 Feb 2004 15:09
46 lines
2632 bytes
Microsoft DBMS use this syntax

UPDATE TableName SET FieldName1=#12/31/2003 12:00:00.000#,
FieldName2='Hello'

You may use parameters without ADO - most data providers (except some very
special) support command parameters.

//------------------------------------------
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:4029e222@newsgroups.borland.com...
> Hi Viatcheslav,
>
> thank you for the answer, I didn't know about parameters.
>
> Anyway, I forgot to mention, I'm looking for an SQL statement to solve the
> problem so that I can use it even when I don't use ADO.
>
> So far, the only solution I found is substituting the comma if present in
> the date/time field.
>
> WRONG: UPDATE TableName SET FieldName1=1234,567, FieldName2='Hello'
>                                           ^^^
> CORRECT: UPDATE TableName SET FieldName1=1234.567, FieldName2='Hello'
>
> Do you have any suggestion about this? Maybe treating that field as string
> instead of double? I don't know, I think there could be problems that way
as
> well.
>
> And how to handle different databases? I mean, with SQL server I must
> substract 2.0 to the date/time field compared to Access. So I should use
> different statements depending on the DB, is it correct?
>
> Thanks.
>
> Steve.
>
>
Technical Details
Message-ID: <402a459f@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <402905f6$1@newsgroups.borland.com> <402915e9$1@newsgroups.borland.com> <4029e222@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-11 07:10:42 PST
From: "Viatcheslav V. Vassiliev" <support@oledbdirect.com>
Newsgroups: borland.public.cppbuilder.database.ado
References: <402905f6$1@newsgroups.borland.com> <402915e9$1@newsgroups.borland.com> <4029e222@newsgroups.borland.com>
Subject: Re: Best way to set a date/time field
Date: Wed, 11 Feb 2004 18:09:14 +0300
Lines: 48
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: <402a459f@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1076512159 213.234.218.42 (11 Feb 2004 07:09:19 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail