SQL Server ODBC Driver problem 
Author Message
 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



Mon, 08 Nov 1999 03:00:00 GMT  
 SQL Server ODBC Driver problem

The syntax like ...WHERE ID=(SELECT... is incorrect!
Use IN instead =
"UPDATE Table1 SET Name=?,State=? WHERE ID IN (SELECT ID FROM Table1 WHERE

Quote:
>SSN=?)"


Quote:
>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



Tue, 09 Nov 1999 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. VB Sql Server Via ADO Problem: [Microsoft][ODBC Sql Server Driver]

2. Problems with ODBC drivers for SQL Server 6.5

3. CR6 Problem w SQL Server ODBC driver 3.6?

4. Problem with ODBC Sql Server Driver

5. Insert date type varible through ODBC SQL server driver to SQL 7.0 database

6. S1T00[Microsoft][ODBC SQL SERVER DRIVER] TIMEOUT EXPIRED ?????????

7. Error: 40002 - 01S03: [Microsoft][ODBC SQL Server Driver]No rows updated or deleted

8. Need faster ODBC drivers for VB-to-SQL Server

9. SQL Server ODBC Driver Error

10. Distribute SQL Server ODBC driver ?

11. S1T00[Microsoft][ODBC SQL SERVER DRIVER] TIMEOUT EXPIRED ????

12. Error : 40002 - 01S03: [Microsoft][ODBC SQL Server Driver]No rows updated or deleted

 

 
Powered by phpBB® Forum Software