
SQL Server ODBC Driver problem
I am writing a SQL Server application in VB 5 using
rdoPreparedStatments. The query I am attempted is:
"UPDATE Table1 SET Name=?,State=? WHERE ID=(SELECT ID FROM Table1 WHERE
SSN=?)"
The ID and SSN columns are unique, so I am selecting a particular row to
update when passed only the SSN. Using the above syntax, when I try to
load the first
rdoParameter in the rdoParameters collection, I get a syntax error back
from the ODBC driver. I've turned on tracing and the error occurs in the
SQLDescribeParam call on the last parameter. Is it trying to interpret
the entire parenthesized subquery as the last parameter? If I code the
query as:
"UPDATE Table1 SET Name=?,State=? WHERE ID=?"
and go off and do the subquery as a seperate query and stuff the ID in a
VB variable, then later load the rdoParameters(2) with that variable,
the Prepared Statement works fine. Any help would be appreciated.
Michael Puchalek