paging datagrid using stored procedures?

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
 
H

Hermit Dave

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...
 
C

Craig Deelsnyder

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top