Microsoft VBScript runtime error '800a01c9'

Discussion in 'ASP General' started by Rahul Bakshi, Sep 28, 2003.

  1. Rahul Bakshi

    Rahul Bakshi Guest

    Hi

    I am getting this error which is frustrating me a lot

    Microsoft VBScript runtime error '800a01c9'

    This key is already associated with an element of this collection

    /process.asp, line 362

    the following is the code snippet:



    Sub AddItemToCart(iItemID, iItemCount)
    aParameters = GetItemParameters(iItemID)

    If dictCart.Exists(iItemID) Then

    If CInt(aParameters(6)) > CInt(dictCart(iItemID)) then
    dictCart(iItemID) = dictCart(iItemID) + iItemCount
    Response.Write "<font face=Verdana color=#c8c8c8 size=2>" &
    iItemCount & " of item # " & iItemID & " have been added to your
    cart.<BR><BR></font>" & vbCrLf
    Else
    Response.Write "<font face=Verdana color=#c8c8c8 size=2>" & "There
    is no more stock available to add<BR><BR></font>" & vbCrLf
    End If

    Else
    If CInt(aParameters(6)) > CInt(dictCart(iItemID)) then
    dictCart.Add iItemID, iItemCount >>>>>>>> line 362 <<<<<<<<<<<<<
    Response.Write "<font face=Verdana color=#c8c8c8 size=2>" &
    iItemCount & " of item # " & iItemID & " have been added to your
    cart.<BR><BR></font>" & vbCrLf
    Else
    Response.Write "<font face=Verdana color=#c8c8c8 size=2>" & "There
    is no more stock available to add<BR><BR></font>" & vbCrLf
    End If

    End If

    End Sub


    Please suggest me if you can find some error



    regards

    Rahul
     
    Rahul Bakshi, Sep 28, 2003
    #1
    1. Advertising

  2. Rahul Bakshi

    Ray at Guest

    That means that you're trying to add something into your dictionary object
    with the same key as another item that already exists. For example:

    This will cause that error:
    objYourDictionaryObject.Add "key1", "Bird"
    objYourDictionaryObject.Add "key1", "Cat"

    This will not cause an error:
    objYourDictionaryObject.Add "key1", "Bird"
    objYourDictionaryObject.Add "key2", "Cat"

    See how the keys are different? They must be.

    "Rahul Bakshi" <> wrote in message
    news:...
    > Hi
    >
    > I am getting this error which is frustrating me a lot
    >
    > Microsoft VBScript runtime error '800a01c9'
    >
    > This key is already associated with an element of this collection
    >
    > /process.asp, line 362
    >
    > the following is the code snippet:
    >
    >


    >
    > Sub AddItemToCart(iItemID, iItemCount)
    > aParameters = GetItemParameters(iItemID)
    >
    > If dictCart.Exists(iItemID) Then
    >
    > If CInt(aParameters(6)) > CInt(dictCart(iItemID)) then
    > dictCart(iItemID) = dictCart(iItemID) + iItemCount
    > Response.Write "<font face=Verdana color=#c8c8c8 size=2>" &
    > iItemCount & " of item # " & iItemID & " have been added to your
    > cart.<BR><BR></font>" & vbCrLf
    > Else
    > Response.Write "<font face=Verdana color=#c8c8c8 size=2>" & "There
    > is no more stock available to add<BR><BR></font>" & vbCrLf
    > End If
    >
    > Else
    > If CInt(aParameters(6)) > CInt(dictCart(iItemID)) then
    > dictCart.Add iItemID, iItemCount >>>>>>>> line 362 <<<<<<<<<<<<<
    > Response.Write "<font face=Verdana color=#c8c8c8 size=2>" &
    > iItemCount & " of item # " & iItemID & " have been added to your
    > cart.<BR><BR></font>" & vbCrLf
    > Else
    > Response.Write "<font face=Verdana color=#c8c8c8 size=2>" & "There
    > is no more stock available to add<BR><BR></font>" & vbCrLf
    > End If
    >
    > End If
    >
    > End Sub
    >
    >
    > Please suggest me if you can find some error
    >
    >
    >
    > regards
    >
    > Rahul
     
    Ray at, Sep 28, 2003
    #2
    1. Advertising

  3. Rahul Bakshi

    Rahul Bakshi Guest

    Hi

    I know the cause of the error

    However i do not understand how the dictionary already has those keys
    as this is the first item I am trying to add.

    thanks for the quick response

    regards
    Rahul

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Rahul Bakshi, Sep 28, 2003
    #3
  4. Rahul Bakshi

    Ray at Guest

    Throw in some response.writes and watch the keys.

    Ray at home

    "Rahul Bakshi" <> wrote in message
    news:%...
    > Hi
    >
    > I know the cause of the error
    >
    > However i do not understand how the dictionary already has those keys
    > as this is the first item I am trying to add.
    >
    > thanks for the quick response
    >
    > regards
    > Rahul
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it!
     
    Ray at, Sep 28, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. PaulieS
    Replies:
    1
    Views:
    3,287
    Kevin Spencer
    Nov 28, 2005
  2. Replies:
    0
    Views:
    946
  3. nicholas.gadacz

    Microsoft VBScript runtime error '800a0046'

    nicholas.gadacz, Oct 21, 2003, in forum: ASP General
    Replies:
    3
    Views:
    462
    Bob Barrows
    Oct 22, 2003
  4. Mike Kanski

    Microsoft VBScript runtime error '800a01fb'

    Mike Kanski, Jan 12, 2004, in forum: ASP General
    Replies:
    3
    Views:
    407
    Mike Kanski
    Jan 12, 2004
  5. PaulieS
    Replies:
    1
    Views:
    238
    Mark Schupp
    Nov 29, 2005
Loading...

Share This Page