ASP - using same variable over two pages?

They have: 46 posts

Joined: Dec 2000

Here is what I am trying to do.

I have a list of data that builds a table. This list is very long and I want to split it over many pages. Its a rankings list so I would like to have no1 to no50 on the first page, then have a link to no51 to no100, then a link to 101 to 150 etc..

Do I just make the recordset or array on the first page like I normally would, then on the next page just use it as if I had created it on that page? Or do I have to create that variable again on each page?

Hope I made that clear enough. I just want to do what search engines do. Split up search results over many pages.

Thank you,

_Nathan.

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

Where is your data comnig from? a database? If so, we can use the recordset object to pagenate the results for you.

They have: 46 posts

Joined: Dec 2000

It is a recordset... What is pagenate?

They have: 46 posts

Joined: Dec 2000

Another quick question while I am here.

In SQL, can you tell it to select say, the first 20 results instead of selecting all or selecting by criteria?

For example I could say:

SELECT 20 FORM thisTable WHERE this ='that'

Thanks Smiling

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

"In SQL, can you tell it to select say, the first 20 results instead of selecting all or selecting by criteria?"

Yes... msSQL:
SELECT TOP 20 * FROM table_name WHERE ID>=40 ..blah blah blah

mySQL:
SELECT * FROM table_name WHERE... blah blah .... LIMIT 40,20

The mySQL query will return 20 records starting with record 40. The msSQL query will return 20 records starting with the record whose ID is 40. There not the same, but close.

pagenate... make into pages
Some links that may help:
http://msdn.microsoft.com/library/partbook/asp20/apagedresultsetexample.htm
http://msdn.microsoft.com/library/default.asp?URL=/library/wcedoc/adoce31/ado30ref_6.htm
http://msdn.microsoft.com/library/psdk/indexsrv/ixuwebqy_1mxx.htm

Mark Hensler
If there is no answer on Google, then there is no question.

They have: 46 posts

Joined: Dec 2000

Thank you very much Smiling

_Nathan.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.