ADO GetRows() example for newbies
Tim Roberts
timr at probo.com
Sun Mar 3 19:06:42 EST 2002
sam_collett at lycos.co.uk (Sam Collett) wrote:
>How could you do pages of records (in ASP for example), you may only
>want a few records at a time (if you have 1000 records for example)?
>For example I may want a page with 10 records per page, with the page
>numbers at the bottom.
>For 100 records:
>10 pages (10 links)
>Start at 1 on page 1, 11 on page 2 etc)
Unfortunately, this varies from SQL provider to SQL provider. In Postgres,
for example, I can say:
SELECT * FROM users ORDER BY lastname OFFSET 20 LIMIT 10;
That fetches me records number 21 through 30. By changing the OFFSET
value, I change which subset I get.
SQLServer uses a different syntax. I believe "TOP" is the SQLServer
equivalent of LIMIT, but I don't know how to do "OFFSET".
Another alternative is to use a cursor, but again the implementation vaires
by backend.
--
- Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
More information about the Python-list
mailing list