473,395 Members | 1,670 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

next record link

229 100+
Hi, I wonder if anyone could point me in the right direction. I have this script that gets a random record from my database. All records have an id, how do I instead of random just go to the next record?
Any pointers would be great.
Thanks
Richard


Expand|Select|Wrap|Line Numbers
  1. <% 
  2. ' ADO Constant. Dont change this 
  3. ' Connection string and SQL statement 
  4.  
  5. sql  = "Select artist,largeimageseven  FROM tblGreet where largeimageseven = 'yes'"
  6. connStr = " Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("/fpdb/greetingcardpro.mdb" ) 
  7. ' Opening database 
  8.  
  9. Set rs = Server.CreateObject("ADODB.Connection")
  10. Set rs = Server.CreateObject("ADODB.Recordset")
  11. rs.Open sql, connStr, 3, , adCmdText 
  12. ' Generating random number from total number of records 
  13.  
  14. Randomize Timer 
  15. intRnd = (Int(RND * rs.RecordCount)) 
  16. ' Now moving the cursor to random record number 
  17. rs.Move intRnd 
  18. ' Showing the random statement 
  19. Response.Write "<span span style=""float: right;""><a href=""/artist.asp?artist=" & rs("artist") & """>next&nbsp; <img src=""plusright.gif"" border=""0""></a></span>"
  20. ' Closing the database 
  21. rs.Close 
  22. Set rs = Nothing 
  23. %>
Aug 2 '08 #1
2 1932
idsanjeev
241 100+
Hello
Add order by in sql statement to arrange your records with id or other column wise.
like-
Expand|Select|Wrap|Line Numbers
  1. sql=selec *from  tablename where column=columnname order by columnname
regards
jha
Aug 4 '08 #2
DrBunchman
979 Expert 512MB
Hi Richard,

Use
Expand|Select|Wrap|Line Numbers
  1. rs.MoveNext
to move to the next record.

Hope this helps,

Dr B
Aug 4 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: george | last post by:
Can anyone help? I query a database and return a result on the column "reference". There might be 7 listings. Each row is displayed in a table, with links through to a detail page. I am working...
9
by: Leroy | last post by:
I really need some help with showing pages of results from queries in say like groups of 20 with next and previous buttons or links. I'm having a lot of trouble figuring out the logic of such a...
3
by: William Wisnieski | last post by:
Hello Everyone, Access 2000, I have a main unbound form with a bound datasheet subform . The subform is bound to a query that returns records based on criteria in the main form. The user...
1
by: asad | last post by:
Hello, i'm working on a greeting card website, there is a page where i'm showing greeting cards, i have done paging on this page with using Datalist and its working well but i have a problem is...
2
by: asad | last post by:
hello friends, how ru all I want to create a custom paging logic in ASP.NET with a next link for example if i have 100 pages record so i want to show 6 pages link on page one and next link ...
11
by: scsTiger | last post by:
I am using Access 2000 as the front end and MS SQL 2000 as the backend. I have a one record form that I set using something like: strSQL = "SELECT * FROM dbo_WBACCT WHERE...
2
by: gavm360 | last post by:
Hello, I have a data entry form that has a button to copy the values of fields (CASECODE,STEPDES,CBOANSWER) into the fields (CASECODE,STEPDES,ANSWER) of a subform on the page. Private Sub...
10
by: fran7 | last post by:
Hi, Anyone know the simplest solution to add a next record link. I have this <a href="page.asp?author=<%=rsCard("author")%>">link</a> I am on a page with one record and want a link to go...
3
by: mbilalk | last post by:
Hello, Well here goes, I am using Microsoft Access to design a user interface for SQL Server database, I am currntly using the project method. I have manged to link it up and get my form to show...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.