PRB: ADO Does Not Support Default Values in Stored Procedures (284942)
The information in this article applies to:
- Microsoft Data Access Components 2.6, when used with:
- Microsoft Data Access Components 2.7, when used with:
This article was previously published under Q284942 SYMPTOMS
Calling a prepared stored procedure that has parameters with default values from ActiveX Data Objects (ADO) may return the following error message if all parameters are not bound:
Run-time error '-2147217900 (80050e14)':
Prepared statement '(@P1 int OUTPUT, @P2 nvarchar(15), @P3 nvarchar(4)) EXEC @P1=Sales' expects parameter @P3, which was not supplied.
CAUSE
The error is reported by SQL Server 7.0. ADO fetches the metadata for the parameters and prepares a stored procedure. ADO is not able to determine if any of the parameters have default values because this information is not available from SQL Server. When the parameter data is not supplied, ADO then calls the prepared call to the stored procedure without the data for the parameter, which generates the error.
RESOLUTION
To work around this error, do not use the Prepare method when calling a stored procedure on SQL Server 7.0.
Using Prepare with a stored procedure is redundant, because a stored procedure on SQL Server is already stored with its execution plan and is prepared when it is originally created.
STATUS
This behavior is by design.
Modification Type: | Major | Last Reviewed: | 5/12/2003 |
---|
Keywords: | kbprb kbStoredProc KB284942 |
---|
|