PRB: Invalid Parameter Number Error Calling RDO BatchUpdate (186276)
The information in this article applies to:
- Microsoft Visual Basic Enterprise Edition for Windows 5.0
- Microsoft Visual Basic Enterprise Edition for Windows 6.0
This article was previously published under Q186276 SYMPTOMS
When calling the RDO Resultset BatchUpdate method to a Microsoft SQL Server
database and setting the Resultset BatchSize property to a large value, the
following error may occur:
Run time error '40002': S1093: [Microsoft][ODBC SQL Server Driver]
Invalid Parameter Number
The BatchSize property controls the number of rows updated/inserted/deleted
in a single round trip.
CAUSE
This error occurs because there is a limit to the number of parameters that
can be called within a single batch statement. That limit is 500 for the
current version of SQLSVR32.DLL, the SQL server ODBC driver. The version
tested is 3.50.0305. The limit of 500 is a factor of the number of
parameters in the SQL statement multiplied by the number of rows in the
batch update. What occurs is that ODBC is sending out the SQL statement
that contains parameters for the new values, the PK value, and the old
values. This SQL statement is repeated for the number of rows to be updated
up to the value of the BatchSize property value. As an example in the code
that follows, the UPDATE statement that is sent to SQL Server looks like
this:
UPDATE tblBatchUpdate SET fldValue=? WHERE ID=? AND fldValue=?;
Note that there are three parameters that give the number of parameters in
the batch when multiplied by the BatchSize property value. If this number
exceeds the parameter limit of 500, you will get the error "Invalid
Parameter Number."
RESOLUTION
The only way to avoid this problem is to lower the value of the BatchSize
property.
STATUS
Microsoft is researching this problem and will post new information here in
the Microsoft Knowledge Base as it becomes available.
Modification Type: | Minor | Last Reviewed: | 3/2/2005 |
---|
Keywords: | kbprb KB186276 |
---|
|