i'm using delphi 7 and have a query in which i'm trying to find names
that have an apostrophe in them, i.e. "o'mally". my problem is that
when i write my select statement i can't get the quotes right. i get
all types of errors no matter what i try. i get "missing right quote",
"invalid token" etc. i've tried using QuotedStr and nothing works.
here is my current attempt in which i get an "invalid use of keyword.
token: n'%'"
sSQL := 'SELECT statenotified, notary_id, LastName, FirstName,' +
' MiddleInitial, Indep, Book_number, Page_number,' +
' CloseRec, TermBegins, TermEnds, DatePickedUp,
FailedToQualify,' +
' Notes, SOSLtrSent FROM notaries WHERE LastName LIKE '''+
''+ edtLastName.Text+'+''%'' AND CloseRec = 1 order by
lastname';Do a search-and-replace using whatever intrinsic function is present in your
language.
Replace all single-quotes with two single quotes.
I.E. - to find
O'Malley,
Search where Last_Name = 'O''Malley'
Betwixt the O and M, there lies not a 'double-quote', but two times a
single.
James Hokes
"Michael Sterling" <stermic@.gw.co.jackson.mo.us> wrote in message
news:f7359f44.0312180837.7167d3aa@.posting.google.com...
> i'm using delphi 7 and have a query in which i'm trying to find names
> that have an apostrophe in them, i.e. "o'mally". my problem is that
> when i write my select statement i can't get the quotes right. i get
> all types of errors no matter what i try. i get "missing right quote",
> "invalid token" etc. i've tried using QuotedStr and nothing works.
> here is my current attempt in which i get an "invalid use of keyword.
> token: n'%'"
> sSQL := 'SELECT statenotified, notary_id, LastName, FirstName,' +
> ' MiddleInitial, Indep, Book_number, Page_number,' +
> ' CloseRec, TermBegins, TermEnds, DatePickedUp,
> FailedToQualify,' +
> ' Notes, SOSLtrSent FROM notaries WHERE LastName LIKE '''+
> ''+ edtLastName.Text+'+''%'' AND CloseRec = 1 order by
> lastname';
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment