Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

question for a command object

Status
Not open for further replies.

crsdev

Programmer
Sep 29, 2006
96
US
Hello Friends,
I have a report with a command -- something like this

select id
from some_table s
where s.name='{?NAME}'

and the user gets to pick a name from a drop down list.

The problem is we have couple of names with apostrophe like "sam's" where the apostrophe is read as a single quote hence produces an error.

does anyone know a workaround for this issue.

THanks.
 
Why do you have quotes around the parameter in the command object? Try it without them.

-k
 
Synapsevampire,
If i don't put the single quotes around the parameter i get the same error.
The column "name" is a varchar in the table: some_table.
and the parameter is type -- string.

Thanks.
 
Try the following. Create two commands:

select id
from some_table s
where replace(s.name,chr(39),'') ='{?NAME}'

Use this to populate your report. The second command, below, should be used to populate your list of values for {?NAME}:

select replace(s.name,chr(39),'')
from some_table s

Do not link the commands to each other.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top