Passing a variable to SQL Select statement

Hi All,

I am having a problem passing a numerical variable to SQLiteSelect statement. The code line is as follows;

rs = QuizLiteDatabase.SQLSelect(“SELECT * FROM Questions WHERE QuestionNumber =’” +CurrentDataRecord+ “’”).

The “CurrentDataRecord” is an integer variable

When I replace the variable with a number, the query works. Like the one below.
rs = QuizLiteDatabase.SQLSelect(“SELECT * FROM Questions WHERE QuestionNumber = 7”).

Please are variable passed to Select query?

Thanks

The SQLSelect statement is expecting a string.

Try
"SELECT * FROM Questions WHERE QuestionNumber = " + Str(numberToLookUp)
You don’t need to put quotes around the number

Jim

Thanks a lot Jim,

I spent frustrated hours on this.