Smithy963
10-29-2009, 12:33 PM
Hi guys,
I'm having trouble returning paged data from ms access 2003 (MDB).
This is for an asp.net page, so I simply need to give my page number as an argument, and for 5 records to be returned.
I have 1,300 records, and I only want to retrieve 5 records a time - starting at index X.
This is what I have so far:
SELECT round((Count([ID]) / 5) + 0.49) AS Pages
FROM tblEmployee;
This snippet returns to me how many pages of 5 records there are.
so for 1300 Records the value returned is 260 (pages).
to view page 1 I can simply do:
SELECT TOP 5 tblEmployee.Title, tblEmployee.FirstNames, tblEmployee.LastName
FROM tblEmployee;
but this always returns the top 5 values.
PARAMETERS PageNo Short;
SELECT TOP 5 tblEmployee.Title, tblEmployee.FirstNames, tblEmployee.LastName
FROM tblEmployee;
So I want the SELECT-ing to start at the index of "5 * PageNo".
I could quite easily return all the records and do my workings in ASP.net, but the trouble is pulling 5 records across the net is easy and pulling 1300 records across the net is insanely not needed.
So is it possible?
Thanks,
Smithy.
p.s. I Omitted there rest of the tables column names for simplicity.
I'm having trouble returning paged data from ms access 2003 (MDB).
This is for an asp.net page, so I simply need to give my page number as an argument, and for 5 records to be returned.
I have 1,300 records, and I only want to retrieve 5 records a time - starting at index X.
This is what I have so far:
SELECT round((Count([ID]) / 5) + 0.49) AS Pages
FROM tblEmployee;
This snippet returns to me how many pages of 5 records there are.
so for 1300 Records the value returned is 260 (pages).
to view page 1 I can simply do:
SELECT TOP 5 tblEmployee.Title, tblEmployee.FirstNames, tblEmployee.LastName
FROM tblEmployee;
but this always returns the top 5 values.
PARAMETERS PageNo Short;
SELECT TOP 5 tblEmployee.Title, tblEmployee.FirstNames, tblEmployee.LastName
FROM tblEmployee;
So I want the SELECT-ing to start at the index of "5 * PageNo".
I could quite easily return all the records and do my workings in ASP.net, but the trouble is pulling 5 records across the net is easy and pulling 1300 records across the net is insanely not needed.
So is it possible?
Thanks,
Smithy.
p.s. I Omitted there rest of the tables column names for simplicity.