🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.interbase.sql
Article #11070

Re: SQL, (Like) as Param?

#11070
From: Wayne Niddery [TeamB]
Date: Thu, 19 Dec 2002 21:10
24 lines
1934 bytes
"Cara" <cbrookins@littlerock.state.ar.us> wrote in message
news:3e01ee6f$1@newsgroups.borland.com...
>
> Query="SELECT LastName,Firstname,employeeNbr FROM Employee where LastName
LIKE :NM)";
> rsP.setCommandText(Query);
> rsP.Param("NM").setAsString() = txtName->Text.c_str();
> rsP.Execute();
>
> The Query works fine if I hardcode the Parameter:
> Query="SELECT LastName,Firstname,employeeNbr FROM Employee where LastName
LIKE 'ABC%')";
> But it flops no matter how I rearrange the Parameter and the %.???

It fails because you still need to include the wildcard somewhere. You can
either put it in the query statement or concatenate it to your string value
before assigning it to the parameter.


--
Wayne Niddery - Logic Fundamentals, Inc. (www.logicfundamentals.com)
RADBooks: http://www.logicfundamentals.com/RADBooks/delphibooks.html
"The only reason some people get lost in thought is because it's unfamiliar
territory." - Paul Fix
Technical Details
Message-ID: <3e02365b$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!news.tele.dk!news.tele.dk!small.news.tele.dk!fu-berlin.de!news.uni-x.net!newsgroups.borland.com!not-for-mail
References: <3e01ee6f$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 114a0e,f21c879f37986fa
X-Google-Attributes: gid114a0e,public
X-Google-ArrivalTime: 2002-12-19 13:15:13 PST
From: "Wayne Niddery [TeamB]" <wniddery@chaff.aci.on.ca>
Newsgroups: borland.public.interbase.sql
References: <3e01ee6f$1@newsgroups.borland.com>
Subject: Re: SQL, (Like) as Param?
Date: Thu, 19 Dec 2002 16:10:26 -0500
Lines: 26
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 209.50.82.158
Message-ID: <3e02365b$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1040332379 209.50.82.158 (19 Dec 2002 13:12:59 -0800)
X-Authenticated-User: wniddery
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!news.tele.dk!news.tele.dk!small.news.tele.dk!fu-berlin.de!news.uni-x.net!newsgroups.borland.com!not-for-mail