Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 16th, 2004, 05:08 PM
Authorized User
 
Join Date: Aug 2004
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default recordsets from Access DB out of sequence?

Hi,
I have an access database with 161 records in it. It has 14 fields, one of those fields is called contentID which is how i am currently pulling the information from the DB to an ASP page. Most of the time i need to pull the information sequentially meaning records from the field contentID 10 to contentID 30. In some cases however, I am trying to retrieve records that are not in sequence, for example contentID 40 to contentID 60 and contentID 62, 63, 64, 161. I can do it sequencially with the following code but not when the recordsets are out of sequence:
ASP code at top of page
-----------------------

<%dim rs,i,ra
set rs=dbExec("SELECT contentID, contentNameEn FROM content ORDER BY contentID")
i=0
%>


Code in the body of page
-------------------------
<%for i=10 to 86
  if (i >= 10 and i <= 19) or i=85 then%>
        <li style="color: #FFFFFF" type="square"><a href="propertyedit.asp?contentID=<%=rs("contentID" )%>">
        Properties</a>&nbsp;
         <a href="contentedit.asp?contentID=<%=rs("contentID") %>">
        Content</a>
        <a HREF="contentEditNew2.asp?contentID=<%=rs("content ID")%>">
        Advanced Editor</a>
        <b><a HREF="contentedit.asp?contentID=<%=rs("contentID") %>">
        <%=rs("contentNameEn")%></a></b></li>
<%end if%>
 <%rs.moveNext
 next%>

Thanks
-Pablo


 
Old September 16th, 2004, 11:25 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Are these contentIds that you wish to retrieve all CONSTANTs?

How do you know that which contentID or sequence you would require to retrieve? 10-30 or 40-60 or anything else. Why is that you are retrieving the contentId like this? Can you explain?

How do you know that you should fix the for loop from 10 to 86???

_________________________
- Vijay G
Strive for Perfection
 
Old September 17th, 2004, 01:11 AM
Authorized User
 
Join Date: Aug 2004
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes they are constant

the page that calls these contentID's is predetermined.

I don't know if the loop should be fixed like this, i am looking for code that would solve this.

What i am looking to accomplish is to pull out the recordsets that fall inbetween sets of numbers so for example records from 61 - 81 and then 92 - 105 on the same ASP page.

Thanks for your help
-pablo

 
Old September 17th, 2004, 01:49 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Quote:
quote:the page that calls these contentID's is predetermined.
Is that predetermined just before the page is called, which means everytime the page is called, these ranges are going to be different? Or those ranges are always same (61 - 81 and then 92 - 105)?

Whichever, I would suggest you check for the rs("contentID") to do things there.
Code:
While Not rs.EOF
  If (rs("contentID") >= x and rs("contentID")<= y) or (rs("contentID") >= A and rs("contentID")<= B) then
    ...do anything that you want here.
  End If
  rs.MoveNext
WEnd
Hope that helps.
Cheers!
_________________________
- Vijay G
Strive for Perfection





Similar Threads
Thread Thread Starter Forum Replies Last Post
Access db is in use mateenmohd Access 2 June 4th, 2008 02:28 AM
RecordSets vs Stored Procedures in Access Roy0 SQL Language 0 December 28th, 2005 02:02 PM
Converting Access DB to Online DB eyal8r Access 5 December 6th, 2004 05:22 AM
access db to sql server db mikersantiago Classic ASP Basics 4 November 16th, 2004 03:33 AM
how far to push Access DB ? seanUK Access 2 July 31st, 2004 05:41 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.