🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: MS Access : 'Data type mismatch in criteria expression'

#6099
From: PS
Date: Tue, 01 Aug 2000 00:00
48 lines
2587 bytes
More testing...
After the initial setup of the parameter type, each time I run the query I
set each Parameters DataType & Direction to what it's current value is, i.e.

    for (int i=0; i<Query->Parameters->Count; i++)
    {
        Query->Parameters->Items[i]->DataType =
Query->Parameters->Items[i]->DataType;
        Query->Parameters->Items[i]->Direction =
Query->Parameters->Items[i]->Direction;
    }

Then this fixes the problem!

"PS" <paul@nospam.stables1.freeserve.co.uk> wrote in message
news:8m6869$49j$1@newsreaderg1.core.theplanet.net...
> I have done some experimenting and if I set the Parameter DataType each
time
> instead of once when the query is set up then it fixes the problem. Why is
> my query losing it's parameter data on Access DB's?
>
> "PS" <paul@nospam.stables1.freeserve.co.uk> wrote in message
> news:8m63pr$29f$1@newsreaderg1.core.theplanet.net...
> > I am using an ADO connection to an Access DB.
> > I have a TADOQuery along the lines of:
> >
> > UPDATE Engineers SET Available = :LOGON, LastLogonOff = :TIMESTAMP WHERE
> > EngineerID = :_SOURCE
> >
> > Where Engineers table fields are Available = Yes/No (True/False),
> > LastLogonOff = Date/Time and EngineerID = Text.
> >
> > The parameter data is set to 'bool', 'TDateTime' and 'AnsiString' using
a
> > Variant type.
> >
> > The first time the query is run, it works fine.
> > The second time the query is run I get a 'Data type mismatch in criteria
> > expression' error.
> >
> > The same code works fine into a SQL 7 database of a similar structure.
> >
> > Thanks in advance,
> > Paul Stables.
> >
> >
>
>
Technical Details
Message-ID: <8m696p$4q4$1@newsreaderg1.core.theplanet.net>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <8m63pr$29f$1@newsreaderg1.core.theplanet.net> <8m6869$49j$1@newsreaderg1.core.theplanet.net>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10698b,fc570e8491be657c
X-Google-Attributes: gid10698b,public
X-Google-Thread: f5cad,fc570e8491be657c
X-Google-Attributes: gidf5cad,public
From: "PS" <paul@nospam.stables1.freeserve.co.uk>
Subject: Re: MS Access : 'Data type mismatch in criteria expression'
Date: 2000/08/01
Message-ID: <8m696p$4q4$1@newsreaderg1.core.theplanet.net>
X-Deja-AN: 653151864
References: <8m63pr$29f$1@newsreaderg1.core.theplanet.net> <8m6869$49j$1@newsreaderg1.core.theplanet.net>
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.3018.1300
X-Complaints-To: abuse@theplanet.net
X-Trace: newsreaderg1.core.theplanet.net 965126169 4932 195.92.39.67 (1 Aug 2000 10:36:09 GMT)
Organization: Customer of Energis Squared
X-MSMail-Priority: Normal
NNTP-Posting-Date: 1 Aug 2000 10:36:09 GMT
Newsgroups: borland.public.cppbuilder.database.ado,borland.public.delphi.database.ado