SQL insertions

What is wrong with the following:

dim sql as text = "SELECT ?1 FROM ?2 WHERE guid = ?3 AND deleteFlag = 0 "
dim rs as iossqliterecordset = r.DB.SQLSelect(sql, getfield, TN, r.guid)

Why does it show an exceptionError on running of “near ?2”

getField, TN and r.guid are all Text.

Try hard coding the table name. Not sure the table name can be a parameter like that. Might be wrong, but let’s start by eliminating variables.

you cant use ?1 style parameters as either the select list (the columns) or the table names
Its for parameter values for the where clause only

Makes sense - thanks both.

[quote=336428:@James Pitchford]What is wrong with the following:

dim sql as text = "SELECT ?1 FROM ?2 WHERE guid = ?3 AND deleteFlag = 0 "
dim rs as iossqliterecordset = r.DB.SQLSelect(sql, getfield, TN, r.guid)

Why does it show an exceptionError on running of “near ?2”

getField, TN and r.guid are all Text.[/quote]

what about using REPLACE for ?1 and ?2
and then do the dim rs as iossqliterecordset = r.DB.SQLSelect(sql, r.guid)