By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,965 Members | 1,468 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,965 IT Pros & Developers. It's quick & easy.

Gridview paging and SELECT with no Where clause

P: n/a
Hello,

I wonder whether someone can explain to me how data is fetched from a
database server when using ASP.NET 2.0's gridview with paging enabled?
My SQL DataSource has a simple "select * from customers" - no where
clause. Using SQL Server's Profiler I can see this same statement is
executed each time I move between pages. Am I right that the ASP
engine on the server is just returning the records required for that
particular page in the grid?

For example - if the grid wants to display relative records 10 thru 19
(say page 2) it still runs select * causing the server to retrieve the
entire table, but only records 10 thru 19 are returned to the
browser?

If this is correct, then after page 2 is rendered to the browser, if a
second user changes record 20 (part of what would be the first user's
3rd page), when the first user requests the third page (records 20
thru 29), then this first user will see the second user's change to
record number 20?

Thanks in advance,

Ray
Mar 17 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
you are correct. the default paging is bind to a dataset, and display record
n thru n + page size. if your table is very large, this is not a good
approach. you want to handle the paging in your code.

-- bruce (sqlwork.com)
"rbrowning1958" wrote:
Hello,

I wonder whether someone can explain to me how data is fetched from a
database server when using ASP.NET 2.0's gridview with paging enabled?
My SQL DataSource has a simple "select * from customers" - no where
clause. Using SQL Server's Profiler I can see this same statement is
executed each time I move between pages. Am I right that the ASP
engine on the server is just returning the records required for that
particular page in the grid?

For example - if the grid wants to display relative records 10 thru 19
(say page 2) it still runs select * causing the server to retrieve the
entire table, but only records 10 thru 19 are returned to the
browser?

If this is correct, then after page 2 is rendered to the browser, if a
second user changes record 20 (part of what would be the first user's
3rd page), when the first user requests the third page (records 20
thru 29), then this first user will see the second user's change to
record number 20?

Thanks in advance,

Ray
Mar 17 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.