PDA

View Full Version : SELECT records 7-14


christrinder
01-13-2003, 01:19 PM
Hi people,

OK, I know how to use SELECT TOP 7 bla bla bla, but is there a easy way to put another page that selects records 7-14?

By the way, I have tried searching the forum for similar questions but didn't find anything. I also realise that there is some coding that gives parameters for the number of records to appear on each page etc, but all I really want to do is add a simple line in the SELECT statement.

Any ideas? Thanks in advance for your help.

Chris

bostjank
01-13-2003, 03:21 PM
I would do it this way

sSQL = "SELECT TOP 14 * FROM table..."
set rs = conn.Execute(sSQL)

i = 1
Do While Not rs.EOF
If i >=7 Then Response.write rs("FieldName")
i = i + 1
rs.MoveNext
Loop

Bostjan

whammy
01-14-2003, 12:34 AM
Or do a search for "database paging ASP" on google, it will turn up plenty of tutorials!

http://www.asp101.com/samples/db_paging.asp

http://www.planet-source-code.com/xq/ASP/txtCodeId.6444/lngWId.4/qx/vb/scripts/ShowCode.htm

http://www.aspfree.com/authors/tom_smith/drp.asp

Although you could use the technique that bostjank posted above as well, and then have a "next" link that posts the new "record start number" (can't think of the right word) to search through to the asp page.

Hope this helps! :)