pramod
4th November 2016, 15:57
I need to run the query that looks like this

qry.str= "select count(*) "&"from "& tabname &" where "& tabname & "._compnr = " & str$(comp)

where tabname and comp are the variables. Trying to get the record count for the table(s). I thought dynamic query will be helpful. How do I construct rest of it to get the result?

Thanks in advance for any idea.
Pramod

pramod
4th November 2016, 16:48
Got it worked. After the sql.fetch I see the rowcount variables is filled with result.

qry.str= "select count(*):1 from "& tabname &" where "& tabname & "._compnr = :2"
sqlid = sql.parse(qry.str)
sql.select.bind(sqlid,1,rowcount)
sql.where.bind(sqlid, 2, comp)
ret = sql.exec(sqlid)
sql.fetch(sqlid)