Syntax to use variable in a query using PB API & SQLite
Posted: Wed Apr 23, 2008 12:04 pm
I am just starting programming in Pure Basic and i can't find the right syntax for queries using variable and passing it from PB api to SQLite database
All Samples below is use on a program done with VB6 and MSAccess and all
work properly
Here is a sample of different small queries using different variable
Using a String var
"SELECT Client.* FROM client WHERE ((Client.ville) = ' " & MyCity & " '))
Using a numeric var
"SELECT Client.* FROM client WHERE ((Client.Zipcode) = " & MyZipCode & "));"
Using a string var and a numeric var and formattinf the query on 2 lines for easy reading
"SELECT Client.* FROM Client WHERE (((Client .ville) = ' " & MyCity & " ') " _
& "AND ((client.CP) =(" & MyCP & "))
Using a string var with like operator
"SELECT Client.* FROM Client WHERE (((Client.CP) like '*" & MyCP & *');"
Using a Datetime Var
"SELECT Client.* FROM Client WHERE (((Client.Dlv) = #" & MyDate & "# ))
All Samples below is use on a program done with VB6 and MSAccess and all

Here is a sample of different small queries using different variable
Using a String var
"SELECT Client.* FROM client WHERE ((Client.ville) = ' " & MyCity & " '))
Using a numeric var
"SELECT Client.* FROM client WHERE ((Client.Zipcode) = " & MyZipCode & "));"
Using a string var and a numeric var and formattinf the query on 2 lines for easy reading
"SELECT Client.* FROM Client WHERE (((Client .ville) = ' " & MyCity & " ') " _
& "AND ((client.CP) =(" & MyCP & "))
Using a string var with like operator
"SELECT Client.* FROM Client WHERE (((Client.CP) like '*" & MyCP & *');"
Using a Datetime Var
"SELECT Client.* FROM Client WHERE (((Client.Dlv) = #" & MyDate & "# ))