How can I use a variable in a SQL where Clause?
The following code works ok with the where clause containing a literal -
Cursor1=SQL1.ExecQuery("SELECT number from testtable where word = 'house'")
but the following code with the same literal in a variable (wordselectstring) produces an error -
Cursor1=SQL1.ExecQuery("SELECT number from testtable where word = wordselectstring")
Here is the code which I used to create the literal in the variable. The log shows the variable wordselectstring contains the literal 'house'
Dim wordselect As String
wordselect="house"
Dim wordselectstring As String
wordselectstring ="'" & wordselect & "'"
Log(wordselectstring)
The following code works ok with the where clause containing a literal -
Cursor1=SQL1.ExecQuery("SELECT number from testtable where word = 'house'")
but the following code with the same literal in a variable (wordselectstring) produces an error -
Cursor1=SQL1.ExecQuery("SELECT number from testtable where word = wordselectstring")
Here is the code which I used to create the literal in the variable. The log shows the variable wordselectstring contains the literal 'house'
Dim wordselect As String
wordselect="house"
Dim wordselectstring As String
wordselectstring ="'" & wordselect & "'"
Log(wordselectstring)