PRB: Implicit Conversion Error Calling Second Stored Procedure (178038)
The information in this article applies to:
- ActiveX Data Objects (ADO) 1.0
- ActiveX Data Objects (ADO) 2.0
- ActiveX Data Objects (ADO) 2.7
- Microsoft Visual InterDev 1.0
- Microsoft Active Server Pages
- Microsoft Data Access Components 2.5
- Microsoft Data Access Components 2.6
- Microsoft Data Access Components 2.7
This article was previously published under Q178038 SYMPTOMS
Either of the following errors occur when you execute an Active Server Pages (ASP)
page that is making subsequent stored procedure calls:
Implicit conversion from the datatype 'varchar' to 'int' is not
allowed. Use the convert function to run this query.
Too many parameters were supplied for procedure <your stored procedure>.
CAUSE
Two conditions that cause this error to occur are as follows: - More than one call to a stored procedure using the same ADODB.Command
object.
-or- - The parameters passed to the stored procedure are of a different data
type from one stored procedure call to the other.
The root cause of this behavior is that the parameters in the command
object's parameter collection are not overwritten with subsequent
definitions; you must first delete the parameter(s) from the
Parameters Collection before defining a new parameter(s) in the collection.
RESOLUTION
Delete the parameter(s) in question using the "Delete" method of the
collection object.
collection.Delete Index
The collection placeholder represents the collection from which you want to
delete an object. The Index argument is a string representing the name of
the object you want to delete.
The Index in the preceding syntax works only for named parameters; a numeric index does not work. In other words, you must name your parameter when you use CreateParameter to create the parameter.
If you use the DataCommand control in Visual InterDev to add the code
necessary to accomplish the stored procedure call, Visual InterDev inserts
code to re-create the Command object. This is a valid approach, but it does
add overhead of re-creating the object.
STATUS
This behavior is by design.
Modification Type: | Minor | Last Reviewed: | 3/14/2005 |
---|
Keywords: | kbprb KB178038 |
---|
|