[Gambas-user] DB.Quote() doesn't quotes apostrophes

Johny Provoost johny.provoost at ...27...
Mon Jan 23 11:17:34 CET 2012


op 23-01-12 00:15, M. Cs. schreef:
> I have a dinamically created query text. I don't know the number of
> parameters passed to the DB.Exec, so I cannot use&1,&2,... form. I
> need to use the DB.Quote()
> My problem is: If I have a string
> mystring="Blackmore's Night",
> the DB.Quote(mystring) won't quote the ', so the query will crash. In
> fact I'm getting query string
> SELECT * FROM CATALOGS WHERE VName='Blackmore's Night'....
> It occurs with sqlite database.
> Is there any solution for that?
>
> Thanks!
>
> Csaba
>
> ------------------------------------------------------------------------------
> Try before you buy = See our experts in action!
> The most comprehensive online learning library for Microsoft developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-dev2
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>

I always use "\"" instead of the ' so names with ' can be used
FMain.tmpSQL = "SELECT * FROM adressen where Naam =" & "\"" & 
FMain.txtNaam.Text & "\""
or
VVar="Blackmore's Night"
tmpSQL="SELECT * from CATALOGS WHERE VName= & "\"" & VVar & "\""

Succes,
Johny




More information about the User mailing list