Article View: borland.public.cppbuilder.database.ado
Article #4616Re: Problem with parameters and like
From: D. Daeschler
Date: Wed, 07 Nov 2001 21:59
Date: Wed, 07 Nov 2001 21:59
24 lines
1838 bytes
1838 bytes
I'm not sure if this is exactly what you're talking about, but if you make sure that the user's input instead of having one ' has two ' (like "o''brien") sql will treat the data as "o'brien" and will not give you an error. Just trying to help - Dave "Formentz" <francesco@leotron.com> wrote: >Hi all, >I have a problem with the like statement in SQL Server, and the parameters. >I would like to do a query like this : >select * from Table1 where Field1 like 'some%' + :p_other + '%' >but when I set the parameter and try to open the query, it returns no result >set, even if the table contains the data I am searching. >I know I can concatenate the parameter in the string at runtime, but if the >user inserts a ' character I am lost, the query will error. > >Anyone got a thing like this work? > >TIA >Ciao > Formentz > >
Technical Details
Message-ID:
<3be9aeac$1_2@dnews>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!news.maxwell.syr.edu!news-out.nuthinbutnews.com!propagator2-austin!propagator!feed2.newsfeeds.com!newsfeeds.com!news-in-austin.nuthinbutnews.com!intgwlon.nntp.telstra.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnewsReferences:
<3be94be1_1@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10698b,644e5decabded7eb X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2001-11-07 13:59:54 PST From: "D. Daeschler" <illusioned@netzero.net> Sender: "D. Daeschler" <illusioned@netzero.net> Reply-To: "D. Daeschler" <illusioned@netzero.net> Subject: Re: Problem with parameters and like Newsgroups: borland.public.cppbuilder.database.ado X-User-Info: 63.162.194.109 63.162.194.109 References: <3be94be1_1@dnews> NNTP-Posting-Host: 207.105.83.65 Message-ID: <3be9aeac$1_2@dnews> Date: 7 Nov 2001 13:59:08 -0800 X-Trace: dnews 1005170348 207.105.83.65 (7 Nov 2001 13:59:08 -0800) Lines: 25 Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!news.maxwell.syr.edu!news-out.nuthinbutnews.com!propagator2-austin!propagator!feed2.newsfeeds.com!newsfeeds.com!news-in-austin.nuthinbutnews.com!intgwlon.nntp.telstra.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnews