Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results page

Status
Not open for further replies.

TrueJoker

Technical User
Jun 14, 2006
115
GB
Having just created a database search page i am trying to apply navigation to the search results....

I have set the repeat region to show 10 results and hope to apply next and previous links so the user can navigate to the next and previous 5 records if there are any.

I have tried using the server behaviours + next record option but this does not work.

Can anyone please advise of the correct way to achieve this please?

Kind Thanks
 
Well if your using sql server you can:

select * from authors
order by au_id

select top 5 * from authors
order by au_id

select top 5 * from authors
where au_id > '274-80-9391' --author id of the 5th author
order by au_id
--Results would be the next 5 authors.

 
I am fairly new to using ASP so please forgive me for not completely understanding. I ahve followed the instructions of a text book to create the search results pages and ahve not entered the sql manually.

the sql that is being sued at the moment is

Code:
SELECT *
FROM [IMPA Membership Database]
WHERE Company LIKE 'MMColParam%'
ORDER BY Company ASC

Would the sql codes you have suggested need to be placed onto a seperate page? for example the first lot of results on a page called results.asp would the next lot of results have to be placed on another page called results2.asp
 
If the search results will always return a relatively small number of rows then you could use the ADO Recordset's built in paging methods ie: PageSize, PageCount, AbsolutePage.

The thought being that a small number of rows would not put too much strain on the web server or bandwidth between your ASP and the database.

If there is the possibility that the search result could return a large number of rows then you don't want to eat bandwidth pulling a bunch of rows into ASP, and then eat a bunch of server RAM holding those rows, if you are ultimately only goint to send 10 rows back to the browser. If this is the case then you want to have the row limiting logic in the database rather than in your ASP. For example you might write a stored procedure where you pass the search values and the page number and it only returns the rows for that particular page.
 
The way i have been trying to add a next and previous page is by using the server behaviours tab in dreamweaver and then using the

Recordset Paging>
Move to Next Record>

But this either sends me to a blank page where i know there should be more records displayed or a page full of records that are not relevant to the search critiera.

I have a limited knowledge of ASP at the moment and as such have no idea of a possible solution so far!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top