The information in this article applies to:
SYMPTOMS
An attempt to call a SQL Server 6.x stored procedure from a dynaset-type
CRecordset throws a CDBException if the procedure has any additional
SELECT, INSERT, UPDATE or DELETE statement other than a single SELECT
statement.
CAUSECalling the following stored procedure from a dynaset-type recordset will cause the error described above:
This is by design as documented in the Help file for SQL Server ODBC
driver version 2.5. You can navigate the Help file in the following way to
get to the description:
"You will get a cursor on SQLExecDirect (Exec procedure_name or{Call procedure_name}) only if the procedure contains one SELECTstatement and nothing else. Otherwise, SQL Server generates an error message. Because of this restriction, you cannot use server cursors with the ODBC catalog functions (which use stored procedures that contain multiple SELECT statements)."You will also get the same error message when using dynaset if your stored procedure has a RETURN statement in addition to a SELECT statement. RESOLUTIONUse a snapshot (with the cursor library loaded) or readOnly forwardOnly- type recordset when the stored procedure has more data manipulation statements other than a single SELECT statement. STATUSThis behavior is by design. REFERENCESMFC Encyclopedia article: "Recordset: Declaring a Class for a Predefined Query" Additional query words: MfcDatabase kbMFC kbVC200 kbVC210 kbVC220 kbVC400 kbVC401 kbVC420 kbVC500 kbVC600 kbdse kbDSupport
Keywords : |
Last Reviewed: July 27, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |