Passing LIKE to ExecQuery2

jpvniekerk

Active Member
Licensed User
Longtime User
I'm not having any luck with trying to pass a "LIKE" SQL statement to ExecQuery2.

This Works:
B4X:
Cur = SQL1.ExecQuery("SELECT * FROM Table WHERE Field1 = 'abcde' AND Field2 LIKE '%cdefg%'")

Cur = SQL1.ExecQuery("SELECT * FROM Table WHERE Field1 = '"&Var1&"' AND Field2 LIKE '%"&Var2&"%'")

Due to "'" characters in the fields, I must use ExecQuery2

This gives an error "bind or column index out of range"
B4X:
Cur = SQL1.ExecQuery2("SELECT * FROM Table WHERE Field1 = ? AND Field2 LIKE '%?%'",Array As String(var1,var2))

It looks like the second "?" does not get passed.

How should I construct the passing of "LIKE" to ExecQuery2?
 
Last edited:
Top