Hi,
Can a property’s value be used in an SQLSelect statement?
I have a property called LangSel (String)
I am using the code below to try and display all rows where the column called myColumn has the value of LangSel.
But when the app is run - I get the following error message: ERROR1: No such Column:LangSel
rs=db.SQLSELECT("SELECT * FROM myTable WHERE myColumn = LangSel")
Am I correct in believing then, that I need to use a prepared statement in order to achieve this?
rs=db.SQLSELECT("SELECT * FROM myTable WHERE myColumn = '" + LangSel + "'")
That should do it.

If you don’t control the content of LangSel it’s better to use a prepared statement.
Albin - I already tried that, but if my LangSel contains for example the word English - I then get an error saying: ERROR 1: No such Column: English
Even though there is definitely a column called myColumn, and at least 30 rows have English in that column.
That’s why I am so confused??
It seems to keep looking for a column called LangSel?
Did you use the quotes in my example above?
(Before and after LangSel)
What db is it?
Here is my full code:
[code] // RUN THE QUERY
rs=db.SQLSELECT(“SELECT * FROM myTable WHERE myColumn = '” + LangSel + “’”)
// IF THERE IS A PROBLEM WITH THE DATABASE
If db.Error Then
// DISPLAY THE ERROR MSGBOX
MsgBox("Error: " + Str(db.ErrorCode) + " - " + db.ErrorMessage)
else
// POPULATE THE LISTBOX
while not rs.eof
Listbox1.addRow rs.Field(“Title”).StringValue
rs.moveNext
wend
end if[/code]
Now I get no error MsgBox, but the listbox which should display all the results, stays blank, but has a scrollbar?
Does my select statement only return the myColumn column?
I was under the impression that it would return all rows where the myColumn matched LangSel - but when I try to display the title column in the listbox - all the rows are blank?
Is myColumn really called myColumn in the database table?
At the moment - yes - until I get things finalised.
I am simply trying to get this to work first, before I rename it appropriately.
Ahhh - think I know where the problem is:
I need to modify the last code segment so that the Title field will appear in column 1 of my listbox (as opposed to column 0) !
Solved it!
// POPULATE THE LISTBOX
while not rs.eof
Listbox1.addRow
Listbox1.Cell(Listbox1.LastIndex, 1) = rs.Field("Title").StringValue
rs.moveNext
wend
Thanks Albin for the help 
Hmmmm…not quite.
More like Stupidityyyyyyy 
Ha! It’s only Tuesday so its ok! The only way I’m not stupid is usually Thursdays 