R
R Reyes
Hi,
I am coding a paging system for an image gallery on a c#/asp.net website.
Problem:
-I can't think of a way to select a SPECIFIC SET OF ROWS returned from a SQL
query in order to prevent a DataTable (where these rows are being placed)
from holding thousands and thousands of unnecessary records!
Example:
I'd like to retrieve the 101st through the 200th records in a set of 1000
records returned because the submitted page is Page 2 of 10 total pages.
Rather than putting ALL one thousand records into a DataTable and removing
the ones I don't need one by one, I'd like to put the 101st-200th records
into that DataTable only.
Why this is a problem:
I ask is because as this image gallery grows, one day it will hit 10,000
images, one day 50,000 who knows. That set of 50,000 records returned will
ALWAYS go into this DataTable and I'll have to remove the other 49,900
records manually before displaying the DataTable, which could be painfully
slow.
Note: Sorting is always done by "Date Submitted" but, how do you get the
101st-200th most recently submitted images? Is there a way for SQL to count
to the 101st image?
I'm thinking there's gotta be an easy solution for this but I don't know
what it is? Any ideas?
Thanks for your time!
I am coding a paging system for an image gallery on a c#/asp.net website.
Problem:
-I can't think of a way to select a SPECIFIC SET OF ROWS returned from a SQL
query in order to prevent a DataTable (where these rows are being placed)
from holding thousands and thousands of unnecessary records!
Example:
I'd like to retrieve the 101st through the 200th records in a set of 1000
records returned because the submitted page is Page 2 of 10 total pages.
Rather than putting ALL one thousand records into a DataTable and removing
the ones I don't need one by one, I'd like to put the 101st-200th records
into that DataTable only.
Why this is a problem:
I ask is because as this image gallery grows, one day it will hit 10,000
images, one day 50,000 who knows. That set of 50,000 records returned will
ALWAYS go into this DataTable and I'll have to remove the other 49,900
records manually before displaying the DataTable, which could be painfully
slow.
Note: Sorting is always done by "Date Submitted" but, how do you get the
101st-200th most recently submitted images? Is there a way for SQL to count
to the 101st image?
I'm thinking there's gotta be an easy solution for this but I don't know
what it is? Any ideas?
Thanks for your time!