Displaying 5 random records from a database table

Discussion in 'ASP General' started by technoplonker, Feb 9, 2004.

  1. I have an access 2000 database and I would like to create a script
    that will allow me to display 5 Random unique results.

    I have tried to use the tutorial at
    http://www.4guysfromrolla.com/webtech/102999-1.shtml

    The problem is that the line objRst.LockType = adLockOptimistic throws
    out the following error:

    'Arguments are of the wrong type, are out of acceptable range, or are
    in conflict with one another.'

    When I set it to 3 instead of the adLockOptimistic I then get an error
    with the line objRst.MoveLast:

    'Rowset does not support fetching backward.'

    Can anyone help?
    technoplonker, Feb 9, 2004
    #1
    1. Advertising

  2. Looks like the problem could be because you are missing the adovbs.inc file.
    Or at least, you use following values instead of the constants:

    adLockOptimistic = 3
    adOpenKeySet = 1

    Perhaps you are opening the recordset with adLockOptimistic lock type, but
    the cursor is being opened as adOpenForwardOnly (the default, 0) mode.

    --
    Manohar Kamath
    Editor, .netWire
    www.dotnetwire.com


    "technoplonker" <> wrote in message
    news:...
    > I have an access 2000 database and I would like to create a script
    > that will allow me to display 5 Random unique results.
    >
    > I have tried to use the tutorial at
    > http://www.4guysfromrolla.com/webtech/102999-1.shtml
    >
    > The problem is that the line objRst.LockType = adLockOptimistic throws
    > out the following error:
    >
    > 'Arguments are of the wrong type, are out of acceptable range, or are
    > in conflict with one another.'
    >
    > When I set it to 3 instead of the adLockOptimistic I then get an error
    > with the line objRst.MoveLast:
    >
    > 'Rowset does not support fetching backward.'
    >
    > Can anyone help?
    Manohar Kamath [MVP], Feb 9, 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. Luke Airig
    Replies:
    0
    Views:
    787
    Luke Airig
    Dec 31, 2003
  2. globalrev
    Replies:
    4
    Views:
    756
    Gabriel Genellina
    Apr 20, 2008
  3. Dan

    Delete records or update records

    Dan, May 10, 2004, in forum: ASP General
    Replies:
    1
    Views:
    461
    Ray at
    May 10, 2004
  4. Darren

    Displaying records in a table

    Darren, Mar 11, 2005, in forum: ASP General
    Replies:
    1
    Views:
    90
    GĂ©rard Leclercq
    Mar 11, 2005
  5. VK
    Replies:
    15
    Views:
    1,159
    Dr J R Stockton
    May 2, 2010
Loading...

Share This Page