PRB: ADO Errors Collection Does Not Contain User-Defined Error Messages (254304)
The information in this article applies to:
- ActiveX Data Objects (ADO) 2.0
- ActiveX Data Objects (ADO) 2.01
- ActiveX Data Objects (ADO) 2.1
- ActiveX Data Objects (ADO) 2.1 SP1
- ActiveX Data Objects (ADO) 2.1 SP2
- ActiveX Data Objects (ADO) 2.5
- Microsoft Data Access Components 2.0
- Microsoft Data Access Components 2.1
- Microsoft Data Access Components 2.1 (GA)
- Microsoft Data Access Components 2.1 SP1
- Microsoft Data Access Components 2.1 SP2
- Microsoft Data Access Components 2.5
- Microsoft OLE DB Provider for SQL Server 7.0
- Microsoft OLE DB Provider for SQL Server 7.01
- Microsoft Visual Basic Professional Edition for Windows 6.0
- Microsoft Visual Basic Enterprise Edition for Windows 6.0
This article was previously published under Q254304 SYMPTOMS
Executing a SQL Server stored procedure (SP) by using ActiveX Data Objects (ADO) does not populate the ADO Errors collection of the Connection object with user-defined errors that are raised in the SP. This behavior only occurs when using the OLE DB Provider for SQL Server (SQLOLEDB) to establish an ADO connection to the SQL Server database.
CAUSE
This problem is specific to the SQLOLEDB. It only occurs when the NOCOUNT SQL Server option has been turned OFF, which is the default setting.
RESOLUTION
Either of the following resolutions may be used to address this issue:
- Turn on the SQL Server NOCOUNT option by using the SET statement before executing the stored procedure by using an ADO connection or command. This adds the user-defined error messages raised in the SP to the ADO Connection object's Errors collection.
-or-
- Use the OLE DB Provider for ODBC (MSDASQL) to open the ADO connection to SQL Server. The MSDASQL Provider establishes the connection to the specified SQL Server by using the SQL Server ODBC driver. The ADO Errors collection is populated with user-defined errors raised in the SP without having to turn on the NOCOUNT option when executed by using an ADO Connection opened with the MSDASQL Provider.
STATUS
This behavior is by design.
Modification Type: | Major | Last Reviewed: | 11/7/2003 |
---|
Keywords: | kbprb KB254304 |
---|
|