Article View: borland.public.interbase.sql
Article #11065Re: SQL, (Like) as Param?
From: Brian
Date: Thu, 19 Dec 2002 16:28
Date: Thu, 19 Dec 2002 16:28
24 lines
1759 bytes
1759 bytes
"Cara" <cbrookins@littlerock.state.ar.us> wrote:
>
>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
>
Try "...... Like " + <V> + ")"
where <V> is your string variable and the '+' are used to
concatenate.
Brian
Technical Details
Message-ID:
<3e01f3b3$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!38.144.126.75.MISMATCH!feed1.newsreader.com!newsreader.com!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<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 08:40:10 PST From: "Brian" <brianellul@ecenglish.com> Sender: "Brian" <brianellul@ecenglish.com> Reply-To: "Brian" <brianellul@ecenglish.com> Subject: Re: SQL, (Like) as Param? Newsgroups: borland.public.interbase.sql X-User-Info: 62.173.4.210 62.173.4.210 References: <3e01ee6f$1@newsgroups.borland.com> NNTP-Posting-Host: 207.105.83.65 Message-ID: <3e01f3b3$1@newsgroups.borland.com> Date: 19 Dec 2002 08:28:35 -0800 X-Trace: newsgroups.borland.com 1040315315 207.105.83.65 (19 Dec 2002 08:28:35 -0800) Lines: 25 Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!38.144.126.75.MISMATCH!feed1.newsreader.com!newsreader.com!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail