paging datagrid using stored procedures?

  • Thread starter Thread starter Max
  • Start date Start date
M

Max

Is it possible or more effecient to use a stored procedure to populate a
datagrid when using datagrid or custom paging? Is it (ADO.NET?) pulling the
entire table into the dataset or is it just pulling the page as defined by
the page size?

I'm assuming that if I use a stored procedure with a datagrid, I won't be
able to use the datagrid's paging anyway, and would have to create my own
code in the stored procedure to return each page of data. Is there any
advantage in doing this?

-Max
 
yeap... you are right....
datagrid does indeed page on the data available... so if you want to page
all you records in a particular table/ view... and if you were to create a
dateview or a dataset and bind it... it will page whatevers available.. (if
your datatable has 1000 records.. it will bind those and then page
accordingly...)
if you just want 10 records it is obviously better to just fetch 10.... and
yes you will have to do the paging on how the rest will be fetched...

other option is to get the full data in dataset/dataview and store it in a
respository like the cache... or session... choice is yours... so that you
dont have to make repeated calls....
asp.net essentially provides you with lots of functionality.. and you have
to work a bit to make it perfect...
 
Max said:
Is it possible or more effecient to use a stored procedure to populate a
datagrid when using datagrid or custom paging? Is it (ADO.NET?) pulling the
entire table into the dataset or is it just pulling the page as defined by
the page size?

I'm assuming that if I use a stored procedure with a datagrid, I won't be
able to use the datagrid's paging anyway, and would have to create my own
code in the stored procedure to return each page of data. Is there any
advantage in doing this?

-Max

Here's a way in old ASP. You could adapt to .NET and return only the
current records to the webserver:

http://www.4guysfromrolla.com/webtech/062899-1.shtml

Yes, if you do any other type of query, etc. using ADO.NET, it pulls all
data meeting the query across.
 
Back
Top