RE: Non initialized Cmd Parameter Collection via ASP vs SQL Server 200

Hi LE,

From your description, you have an classic ASP program which will use ADO
component to access database and execute some stored procedure. The
application runs well originally, but raised some "parameter index...."
error when change the database from SQL server 2000 to SQL Server 2005,

Based on the code you provided, you use a loop to add parameters into ADO
command object via index. I would suggest you use ADOCommand.Create
Parameter and Append method to create the parameters and append them into
Parameters collection. Here is a kb article demonstrate this:

#How to run SQL Server stored procedures from an ASP Page

you can try the code style in it to see whether it works. Also, you can try
calling some other simple stored procedure s to see whether the problem is
specific to a particular stored procedure.


Steven Cheng

Microsoft MSDN Online Support Lead

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:

Get notification to my posts through email? Please refer to

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
This posting is provided "AS IS" with no warranties, and confers no rights.

From: =?Utf-8?B?TGFycy1Fcmlr?= <lars-erik@xxxxxxxxxxxxxxxx>
Subject: Non initialized Cmd Parameter Collection via ASP vs SQL Server 200
Date: Tue, 13 May 2021 01:41:01 -0700


I have some ancient VBScript code running in ASP 3.0. In our development
area the code runs well, but at our customers server it fails claiming
the parameter collection is not initialized. (IE. index out of range)
The stuff has run fine on SQL Server 2000 before, but the customer has
upgraded to SQL Server 2005.
They haven't upgraded to SP 1 or 2 yet, but I'm not entirely sure that is
the reason.

Any other possible reasons why the following code won't pre-populate the
parameters collecti