Article View: borland.public.delphi.database.dotnet
Article #667Re: SQL with Like command ????
From: Wayne Niddery [TeamB]
Date: Thu, 07 Oct 2004 13:36
Date: Thu, 07 Oct 2004 13:36
23 lines
1895 bytes
1895 bytes
Hans wrote:
> But the strSQL already has single ' , so how to include it in my
> SQLstr?
In all programming languages, the standard way to handle this is to double
up the character, so in this case, it would be:
SQLStr:='Select * From Relaties WHERE (Naam Like ''Test'')';
- 'test' is surrounded with doubled single quotes, not doublequotes.
You can also do it like this:
SQLStr:='Select * From Relaties WHERE (Naam Like ' + QuoteStr('Test') + ')';
The advantage of using QuotedStr is it will take care of any embedded quotes
for you as wll - such as apostrophes in names.
--
Wayne Niddery - Logic Fundamentals, Inc. (www.logicfundamentals.com)
RADBooks: http://www.logicfundamentals.com/RADBooks.html
Light is faster than sound, which is why some folks appear bright
before they speak.
Technical Details
Message-ID:
<41654670$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.frii.net!newsfeed.frii.net!news.compaq.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<41629951@newsgroups.borland.com> <4162a843@newsgroups.borland.com> <41642d3a$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 1effe6,188547e999caab4e X-Google-Attributes: gid1effe6,public X-Google-Language: ENGLISH,ASCII-7-bit Reply-To: "Wayne Niddery [TeamB]" <wniddery@chaffaci.on.ca> From: "Wayne Niddery [TeamB]" <wniddery@chaffaci.on.ca> Newsgroups: borland.public.delphi.database.dotnet References: <41629951@newsgroups.borland.com> <4162a843@newsgroups.borland.com> <41642d3a$1@newsgroups.borland.com> Subject: Re: SQL with Like command ???? Date: Thu, 7 Oct 2004 09:36:49 -0400 Lines: 25 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 NNTP-Posting-Host: 69.17.156.109 Message-ID: <41654670$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1097156208 69.17.156.109 (7 Oct 2004 06:36:48 -0700) X-Authenticated-User: wniddery Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.frii.net!newsfeed.frii.net!news.compaq.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail