🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Data Type Mismatch in Criteria Expression

#1367
From: Kim Utley
Date: Tue, 27 Jul 2004 15:11
130 lines
4974 bytes
Mr. Vassiliev,

That worked great. Thank you for your time and effort.

Kindest Regards,
Kim Utley

"Viatcheslav V. Vassiliev" <support@oledbdirect.com> wrote in message
news:410605da$1@newsgroups.borland.com...
> For command that does not return records, use TADOCommand:
>
>  ADOCommand1->ParamCheck = false;
>  ADOCommand1->CommandText = "DELETE FROM test WHERE Col2 < #08/26/04
> 10:17:30#";
>  ADOCommand1->Execute();
>
> ParamCheck should be false because there is ':' in command text. For Jet
> (Access) you may also need to write DELETE * FROM ... (not '*' char).
>
> Use parameter will set date using TDateTime and does not depend on string
> format:
>
>  ADOCommand1->ParamCheck = true;
>  ADOCommand1->CommandText = "DELETE FROM test WHERE Col2 < :param";
>  ADOCommand1->Parameters->Items[0]->Value = EncodeDate(2004, 8, 26);
>  ADOCommand1->Execute();
>
> //------------------------------------------
> 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)
>
> "Kim Utley" <kim@simsware.com> �������/�������� � �������� ���������:
> news:41055c66$1@newsgroups.borland.com...
> > Oops,
> >
> > Meant to say:
> >
> > > I wish to use a SQL statement because if I use TADOTable it wants to
> read
> > up
> > > all ROWS when I open the table.
> >
> >
> > "Kim Utley" <kim@simsware.com> wrote in message
> > news:41055bb8$1@newsgroups.borland.com...
> > > Am using Microsoft Access with TADOQuery and TADOConnection.
> > >
> > > What do you mean by 'use parameter'?
> > >
> > > I wish to to SQL statement because if I use TADOTable it wants to read
> up
> > > all columns when I open the table.
> > >
> > >     adoQuery->SQL->Clear();
> > >     adoQuery->SQL->Add( "DELETE FROM EventHistoryTbl WHERE
> > >             DateTimeStamp < '06/26/04 10:17:30'" );
> > >
> > >     //    this is where the exception is thrown...
> > >     //
> > >     adoQuery->ExecSQL();
> > >
> > >
> > > Kindest Regards,
> > >
> > >
> > > Kim
> > >
> > > "Viatcheslav V. Vassiliev" <support@oledbdirect.com> wrote in message
> > > news:41053e2f$1@newsgroups.borland.com...
> > > > It depends on DBMS. General solution that should work with any DBMS
is
> > to
> > > > use parameter for dates.
> > > >
> > > > //------------------------------------------
> > > > 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)
> > > >
> > > > "Kim Utley" <kim@simsware.com> �������/�������� � ��������
���������:
> > > > news:41052c3f$1@newsgroups.borland.com...
> > > > > Hi All,
> > > > >
> > > > > Am working on BCB 6 with TADO... objects, specifically
> TADOConnection
> > > and
> > > > > TADOQuery in my example problem. I am attempting to delete all
rows
> in
> > a
> > > > > table that have a date/time stamp older than 'x' amount of days.
> > > > >
> > > > > I am issuing the following SQL statement be am getting "Data type
> > > mismatch
> > > > > in criteria express' exception:
> > > > >
> > > > > DELETE FROM EventHistoryTbl WHERE DateTimeStamp < '06/26/04
> 10:17:30'
> > > > >
> > > > > I've also tried:
> > > > >
> > > > > DELETE FROM EventHistoryTbl WHERE DateTimeStamp < #06/26/04
> 10:17:30#
> > > > >
> > > > > Does anyone know why I'm getting this error?
> > > > >
> > > > > Kindest Regards,
> > > > >
> > > > >
> > > > > Kim L. Utley
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>
Technical Details
Message-ID: <410670bb$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!npeer.de.kpn-eurorings.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <41052c3f$1@newsgroups.borland.com> <41053e2f$1@newsgroups.borland.com> <41055bb8$1@newsgroups.borland.com> <41055c66$1@newsgroups.borland.com> <410605da$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,8373fe4b7c83316d
X-Google-Attributes: gid10698b,public
X-Google-Language: ENGLISH,ASCII
From: "Kim Utley" <kim@simsware.com>
Newsgroups: borland.public.cppbuilder.database.ado
References: <41052c3f$1@newsgroups.borland.com> <41053e2f$1@newsgroups.borland.com> <41055bb8$1@newsgroups.borland.com> <41055c66$1@newsgroups.borland.com> <410605da$1@newsgroups.borland.com>
Subject: Re: Data Type Mismatch in Criteria Expression
Date: Tue, 27 Jul 2004 10:11:53 -0500
Lines: 132
Organization: SIMS, Inc.
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
NNTP-Posting-Host: 65.205.74.2
Message-ID: <410670bb$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1090941115 65.205.74.2 (27 Jul 2004 08:11:55 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!npeer.de.kpn-eurorings.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail