On error

Discussion in 'ASP General' started by polilop, May 3, 2005.

  1. polilop

    polilop Guest

    I have a page that opens a recordset (gets id from previus) but there may
    not be values in the table
    for the given id, so i get the BOF EOF errors. How can i handle the error so
    it can
    redirect to previus? All that i found is on error resume next is there
    someway to
    say on error go to a function?
     
    polilop, May 3, 2005
    #1
    1. Advertising

  2. polilop wrote:
    > I have a page that opens a recordset (gets id from previus) but there
    > may not be values in the table
    > for the given id, so i get the BOF EOF errors. How can i handle the
    > error so it can
    > redirect to previus? All that i found is on error resume next is there
    > someway to
    > say on error go to a function?


    No,

    Best practice is to check if EOF is true immediately after opening the
    recordset. There is never any reason to raise a BOF/EOF error.

    'open the rs, then:

    if not rs.EOF then
    'process the rs
    else
    'handle the empty-recordset situation
    end if

    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 [MVP], May 3, 2005
    #2
    1. Advertising

  3. polilop

    polilop Guest

    thanks
    "Bob Barrows [MVP]" <> wrote in message
    news:%...
    > polilop wrote:
    >> I have a page that opens a recordset (gets id from previus) but there
    >> may not be values in the table
    >> for the given id, so i get the BOF EOF errors. How can i handle the
    >> error so it can
    >> redirect to previus? All that i found is on error resume next is there
    >> someway to
    >> say on error go to a function?

    >
    > No,
    >
    > Best practice is to check if EOF is true immediately after opening the
    > recordset. There is never any reason to raise a BOF/EOF error.
    >
    > 'open the rs, then:
    >
    > if not rs.EOF then
    > 'process the rs
    > else
    > 'handle the empty-recordset situation
    > end if
    >
    > 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"
    >
     
    polilop, May 3, 2005
    #3
    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. hfk0
    Replies:
    2
    Views:
    21,683
  2. JavaQueries
    Replies:
    1
    Views:
    3,685
    John C. Bollinger
    Mar 1, 2005
  3. Balaji
    Replies:
    3
    Views:
    10,121
  4. Bishop
    Replies:
    1
    Views:
    795
    Bishop
    Feb 24, 2007
  5. juvi
    Replies:
    3
    Views:
    1,055
    Alexey Smirnov
    Jan 22, 2009
Loading...

Share This Page