🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

SQL, (Like) as Param?

#11064
From: Cara
Date: Thu, 19 Dec 2002 16:06
14 lines
1450 bytes
Does anyone know the correct syntax for using 'Like %' in an SQL statment and passing it a parameter?  I am using the SQLAPI to connect to the database.  

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 %.???

Thanks,
Cara
Technical Details
Message-ID: <3e01ee6f$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-09!supernews.com!news.maxwell.syr.edu!newsfeed.online.be!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 114a0e,f21c879f37986fa,start
X-Google-Attributes: gid114a0e,public
X-Google-ArrivalTime: 2002-12-19 08:09:40 PST
From: "Cara" <cbrookins@littlerock.state.ar.us>
Sender: "Cara" <cbrookins@littlerock.state.ar.us>
Reply-To: "Cara" <cbrookins@littlerock.state.ar.us>
Subject: SQL, (Like) as Param?
Newsgroups: borland.public.interbase.sql
X-User-Info: 170.94.26.21 170.94.26.21    
NNTP-Posting-Host: 207.105.83.65
Message-ID: <3e01ee6f$1@newsgroups.borland.com>
Date: 19 Dec 2002 08:06:07 -0800
X-Trace: newsgroups.borland.com 1040313967 207.105.83.65 (19 Dec 2002 08:06:07 -0800)
Lines: 15
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.online.be!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail