Article View: borland.public.cppbuilder.database.ado
Article #4632Re: Problem with parameters and like
From: Rick Golden
Date: Fri, 09 Nov 2001 19:43
Date: Fri, 09 Nov 2001 19:43
42 lines
2186 bytes
2186 bytes
What Mister Daeschler said , it this is very important to double quote your string,.... take a look at the very usual QuotedStr() in the help file, I just can't live without it... bye! D. Daeschler <illusioned@netzero.net> wrote in message news:3be9aeac$1_2@dnews... > > 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:
<3bec319e_2@dnews>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newshub2.rdc1.sfba.home.com!news.home.com!newsfeed.mesh.ad.jp!uunet!osa.uu.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnewsReferences:
<3be94be1_1@dnews> <3be9aeac$1_2@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-09 11:57:50 PST Reply-To: "Rick Golden" <GoldenRick@hotmail.com> From: "Rick Golden" <GoldenRick@hotmail.com> Newsgroups: borland.public.cppbuilder.database.ado References: <3be94be1_1@dnews> <3be9aeac$1_2@dnews> Subject: Re: Problem with parameters and like Date: Fri, 9 Nov 2001 14:43:51 -0500 Lines: 44 Organization: Gold X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2314.1300 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 NNTP-Posting-Host: 198.168.250.105 Message-ID: <3bec319e_2@dnews> X-Trace: dnews 1005334942 198.168.250.105 (9 Nov 2001 11:42:22 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newshub2.rdc1.sfba.home.com!news.home.com!newsfeed.mesh.ad.jp!uunet!osa.uu.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnews