Gridview paging and SELECT with no Where clause

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • rbrowning1958

    #1

    Gridview paging and SELECT with no Where clause

    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
  • =?Utf-8?B?YnJ1Y2UgYmFya2Vy?=

    #2
    RE: Gridview paging and SELECT with no Where clause

    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)


    "rbrowning1 958" 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
    >

    Comment

    Working...