Connecting Tech Pros Worldwide Forums | Help | Site Map

trouble with sql query and quotes

Danny
Guest
 
Posts: n/a
#1: Nov 12 '05
I am doing this on a table in a database.

sql query = "select all names where instr(sourcefield,searchstring) > 0"

this fails when there is embedded quotes in sourcefield such as

"the book entitled "The Sun Shines" is a book about..."

how to handle this?

thanks



paii, Ron
Guest
 
Posts: n/a
#2: Nov 12 '05

re: trouble with sql query and quotes


I solved this by passing sourcefield to a function that replaces the single
quote with 2 quotes.

"Danny" <dannywork5@hotmail.com> wrote in message
news:Kw_1c.9683$UF1.960977@news4.srv.hcvlny.cv.net ...[color=blue]
> I am doing this on a table in a database.
>
> sql query = "select all names where instr(sourcefield,searchstring) > 0"
>
> this fails when there is embedded quotes in sourcefield such as
>
> "the book entitled "The Sun Shines" is a book about..."
>
> how to handle this?
>
> thanks
>
>[/color]


Danny
Guest
 
Posts: n/a
#3: Nov 12 '05

re: trouble with sql query and quotes


for x = 1 to infinity
print "Thank you"
next x

LOL, thanks a ton, that did it


"paii, Ron" <paii@packairinc.com> wrote in message
news:104h092rinqcie2@corp.supernews.com...[color=blue]
> I solved this by passing sourcefield to a function that replaces the[/color]
single[color=blue]
> quote with 2 quotes.
>
> "Danny" <dannywork5@hotmail.com> wrote in message
> news:Kw_1c.9683$UF1.960977@news4.srv.hcvlny.cv.net ...[color=green]
> > I am doing this on a table in a database.
> >
> > sql query = "select all names where instr(sourcefield,searchstring) > 0"
> >
> > this fails when there is embedded quotes in sourcefield such as
> >
> > "the book entitled "The Sun Shines" is a book about..."
> >
> > how to handle this?
> >
> > thanks
> >
> >[/color]
>
>[/color]


Closed Thread