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

Posted on 2005-04-08
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")
            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
    LVL 4

    Expert Comment

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

    Accepted Solution

    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


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

    Expert Comment

    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?

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    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 information …
    Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    779 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

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now