Well, that was the thing I was fearing: I must handle the characters
by my own. The strange thing is , that if I have something like
DB.Exec("SELECT * FROM CATALOGS WHERE VName=&1","Blackmore's Night'")
the query won't fail.
I can even have query
DB.Exec("SELECT * FROM CATALOGS WHERE VName LiKE &1","%'%")
and the result won't fail. I wonder why? What's the advance in .Exec
over .Quote?I will try Johnny's trick. Thanks! Csaba 2012/1/23, Benoît Minisini <[email protected]>: > Le 23/01/2012 00:15, M. Cs. a écrit : >> 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 >> > > You must use DB.Subst(), not DB.Quote(). Maybe I said DB.Quote() > somewhere recently, that was a mistake then. > > Anyway you are right: DB.Quote(), which is used for quoting fields or > table names, is unable to quote "'" correctly. But you should not use > such character inside table or field names, so... > > Regards, > > -- > Benoît Minisini > > ------------------------------------------------------------------------------ > 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 > [email protected] > https://lists.sourceforge.net/lists/listinfo/gambas-user > ------------------------------------------------------------------------------ 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 [email protected] https://lists.sourceforge.net/lists/listinfo/gambas-user
