[Gambas-user] mysql seach string contains single quote

Charlie Reinl Karl.Reinl at ...2345...
Sat Aug 10 11:56:30 CEST 2013


Am Samstag, den 10.08.2013, 00:02 -0700 schrieb bill-lancaster:
> Have seen a couple of posts that refer to this but can't quite understand the
> answer
> 
> I have a database which conntains a string  'Queen's Head'
> 
> so 
>      hResult = hConn.Exec("SELECT contacts.* FROM contacts WHERE Title =
> 'Queen's Head'")
> produces an error.
> 
> How best to solve this?
> 
Salut,

and this work also:

hResult = hConn.Exec("SELECT contacts.* FROM contacts WHERE Title
=&1" ,"'Queen's Head'") ' that is the gambas way

or 

hResult = hConn.Exec("SELECT contacts.* FROM contacts WHERE Title =" &
Replace("'Queen's Head'","'","''")) ' that is the SQL way

** both examples not tested 
-- 
Amicalement
Charlie





More information about the User mailing list