Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Displaying 5 random records from a database table

Reply
Thread Tools

Displaying 5 random records from a database table

 
 
technoplonker
Guest
Posts: n/a
 
      02-09-2004
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?
 
Reply With Quote
 
 
 
 
Manohar Kamath [MVP]
Guest
Posts: n/a
 
      02-09-2004
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: m...
> 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?



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Database Database Database Database scott93727@gmail.com Computer Information 0 09-27-2012 02:43 AM
DataBase DataBase DataBase DataBase scott93727@gmail.com Computer Information 0 09-26-2012 09:40 AM
Math.random() and Math.round(Math.random()) and Math.floor(Math.random()*2) VK Javascript 15 05-02-2010 03:43 PM
random.random(), random not defined!? globalrev Python 4 04-20-2008 08:12 AM
Displaying records in a table Darren ASP General 1 03-11-2005 10:20 AM



Advertisments