Item cannot be found in the collection corresponding to the requested name or ordinal.

Posted on 2005-04-08
Medium Priority
Last Modified: 2012-06-27
I get the error below:

ADODB.Command error '800a0cc1'

Item cannot be found in the collection corresponding to the requested name or ordinal.

/Help/request.asp, line 36

Here's the code:

Stored procedure to add user data to database table.
      SET CONN = Server.CreateObject("ADODB.Connection")
      SET HD_COMM = Server.CreateObject("ADODB.Command")
            CONN.open Application("strConnect")
            WITH HD_COMM
                  .ActiveConnection = CONN
                  .CommandText = "sp_add_hdRequest"
                  .CommandType= adCmdStoredProc
                  .Parameters.Append .CreateParameter("@fname", adVarChar, adParamInput,64,FORM_FNAME)
                  .Parameters.Append .CreateParameter("@lname", adVarChar, adParamInput,64,FORM_LNAME)
                  .Parameters.Append .CreateParameter("@pnum", adVarChar, adParamInput,64,FORM_PNUM)                  
                  .Parameters.Append .CreateParameter("@email", adVarChar, adParamInput,64,FORM_EMAIL)
                  .Parameters.Append .CreateParameter("@hd_request_id", adInteger, adParamOutput) 'Get ID(primary key) of inserted data
            END with
      hd_request_id = HD_COMM.Parameters("hd_request_id") 'Capture id of inserted data  <------ Line 36

Here's my stored procedure:

CREATE PROCEDURE sp_add_hdRequest
       @fname VARCHAR,
           @lname VARCHAR,
           @pnum VARCHAR,
          @email VARCHAR,
           @hd_request_id INT OUTPUT
                INSERT INTO tblRequest (Requestor_fname,Requestor_lname,Requestor_phone,Requestor_email)
                VALUES (@fname, @lname, @pnum, @email)

           SET @hd_request_id = @@IDENTITY

Question by:Isaac
  • 2

Expert Comment

ID: 13737541
I think a 'return' is missing in your stored procedure.
LVL 23

Accepted Solution

apresto earned 1800 total points
ID: 13737808
shouldnt this:

hd_request_id = HD_COMM.Parameters("hd_request_id") 'Capture id of inserted data

be this:

hd_request_id = HD_COMM.Parameters("@hd_request_id") 'Capture id of inserted dat
LVL 23

Expert Comment

ID: 13737817

hd_request_id = HD_COMM.Parameters("@hd_request_id").Value

Expert Comment

ID: 13737839
This usually occurs when a column name is misspelled or otherwise different than what actually exists in the database. Have you confirmed that the column names in the insert statement actually exist? Also, are you certain that the error is from the stored procedure and not from a select statement within the ASP?

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses
Course of the Month17 days, 11 hours left to enroll

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question