Subject | Re: locate O'Connor |
---|---|
Author | Adam |
Post date | 2005-09-28T00:18:16Z |
--- In firebird-support@yahoogroups.com, "delphigurusam" <shunt@n...>
wrote:
In the Query Component.
select id, name, blah
from employee
where Upper(LastName) = :LastName
Go to params, select LastName and make the field type ftString, and
ParamType = ptInput.
Now to your other routine, instead of stuffing around with string
manipulations
qry.parambyname('lastname').value := UpperCase(dbeditLastName.Text);
Then you can run the query.
If you do need to dynamically build the query, then you will need to do
a stringreplace to replace all #39 with #39+#39, but the param route is
a better (and safer) way to go.
Adam
wrote:
> FB 1.5.2 B:4731Sam, use parameters, it takes care of that for you.
>
> sql.strings[2]:='where
> upper(Last_Name)='+#39+uppercase(dbeditLastName.Text)+#39+' ';
>
> errors when dbeditLastName.Text contains an apostrophe (single quote)
> in the name, as in O'Connor. The query reports that "Connor" is an
> unknown token.
>
> I know I should be able to figure this out, but I'm feeling brain dead
> and I need this tonight (if possible). Anyone out there want to help
> a "delphidummy"?
>
> Thx
> Sam Hunt
In the Query Component.
select id, name, blah
from employee
where Upper(LastName) = :LastName
Go to params, select LastName and make the field type ftString, and
ParamType = ptInput.
Now to your other routine, instead of stuffing around with string
manipulations
qry.parambyname('lastname').value := UpperCase(dbeditLastName.Text);
Then you can run the query.
If you do need to dynamically build the query, then you will need to do
a stringreplace to replace all #39 with #39+#39, but the param route is
a better (and safer) way to go.
Adam