exception '80020009'

Discussion in 'ASP General' started by Marco, Feb 14, 2004.

  1. Marco

    Marco Guest

    When i try to execute this cycle:

    <%while not (oRS("IDFoto")=IDFoto)
    IDPrec=oRS("IDFoto")
    oRS.MoveNext
    wend%>

    i get the error:
    80020009 Exception Occurred

    I want to select the record with the field IDFOTO= the value in the variable
    IDFoto
    I'm sure the cycle doesn't work, if i modify it so:

    while (oRS("IDFoto")=IDFoto)

    it works (but with no right result of course)

    Does anyone can help me??

    Thanks

    Marco
     
    Marco, Feb 14, 2004
    #1
    1. Advertising

  2. Marco

    Bob Barrows Guest

    Marco wrote:
    > When i try to execute this cycle:
    >
    > <%while not (oRS("IDFoto")=IDFoto)
    > IDPrec=oRS("IDFoto")
    > oRS.MoveNext
    > wend%>
    >
    > i get the error:
    > 80020009 Exception Occurred
    >
    > I want to select the record with the field IDFOTO= the value in the
    > variable IDFoto
    > I'm sure the cycle doesn't work, if i modify it so:
    >
    > while (oRS("IDFoto")=IDFoto)
    >
    > it works (but with no right result of course)
    >
    > Does anyone can help me??
    >
    > Thanks
    >
    > Marco


    Why are you using a loop to find a record? Finding records is what queries
    were designed to do very efficiently. I suggest adding this search criterion
    to the query that you use to open the recordset.

    If for some reason you need to retrieve records in addition to the records
    that meet this search criterion, then use the recordset's Find method to get
    the record.

    If IDFoto is a text/char field:
    oRs.Find "IDFoto='" & IDFoto & "'"

    If numeric:
    oRs.Find "IDFoto=" & IDFoto

    Here is the documentation on the Find method:
    http://msdn.microsoft.com/library/en-us/ado270/htm/mdmthfindmethodado.asp

    If there are multiple records that meet the criteria, use the Filter
    property instead:
    http://msdn.microsoft.com/library/en-us/ado270/htm/mdprofilter.asp?frame=true

    You will need to use a cursor that supports bookmarks (adOpenStatic) in
    order to use these methods.

    HTH,
    Bob Barrows
    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"
     
    Bob Barrows, Feb 14, 2004
    #2
    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. olivier Micheli

    ADODB.Field error '80020009

    olivier Micheli, Aug 15, 2003, in forum: ASP General
    Replies:
    0
    Views:
    249
    olivier Micheli
    Aug 15, 2003
  2. middletree

    80020009 -- ready for a tough one?

    middletree, Jan 9, 2004, in forum: ASP General
    Replies:
    4
    Views:
    128
    middletree
    Jan 9, 2004
  3. psaban

    error '80020009' Exception occurred

    psaban, Jun 10, 2004, in forum: ASP General
    Replies:
    0
    Views:
    168
    psaban
    Jun 10, 2004
  4. dmiller23462

    Error code 80020009 "Exception Occured"

    dmiller23462, Aug 17, 2004, in forum: ASP General
    Replies:
    2
    Views:
    327
    dmiller23462
    Aug 18, 2004
  5. dmiller23462

    Error code 80020009 "Exception Occured"

    dmiller23462, Aug 17, 2004, in forum: ASP General
    Replies:
    0
    Views:
    207
    dmiller23462
    Aug 17, 2004
Loading...

Share This Page