PDA

Click to See Complete Forum and Search --> : Paging data for presentation


hellswraith
Apr 24th, 2003, 01:58 PM
I am creating some asp.net forums (similar to the vBulletin software here, with less features). I have pretty much the whole thing done except some details like paging the data.

To get the the point, have any of you paged your data without using stored datasets? Remember, this is web based and I can't cache the data without a serious hit in server performance, nor can I afford to hit the database and return all results each time when I need only 20 or so out of 1000+.

I have a book called ASP.NET Data Web Controls (http://www.amazon.com/exec/obidos/tg/detail/-/0672325012/qid=1051207069/sr=8-1/ref=sr_8_1/104-6348554-0272704?v=glance&s=books&n=507846) by Scott Mitchell. In it, he goes over a couple different ways to provide custom paging to the web datagrid control. I will probably end up implementing one of his, but was wondering if there are ways that some of you have tried that have been proven to be real good for you?

Edneeis
Apr 24th, 2003, 04:00 PM
Sorry I've only done basic paging but here is an article I just found on caching which is related.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/cachingarch.asp

Lunatic3
Apr 25th, 2003, 02:08 AM
Do you mean something like this:
From C# Web Developer's Guide
www.syngress.com/solutions
Differences between DataReader
Model and DataSet Model
Data in ADO.NET is disconnected for all practical purposes. Data access can be
broken down into two methods, or models.The DataSet model involves reading
the data into a local cache, interacting with it, and discarding, or synchronizing,
the data back to the source.The DataReader model does not allow for updating
data or reusing it.With a DataReader, data is read once and discarded when the
next row is read.
When you populate a DataSet from the database, a connection is opened, the
data is selected and returned into a DataTable, and then the connection is closed.
The data is present in the DataTable, and an application is free to interact with itread.
When you populate a DataSet from the database, a connection is opened, the
data is selected and returned into a DataTable, and then the connection is closed.
The data is present in the DataTable, and an application is free to interact with it
in any manner, however, the database is free to do whatever it needs to do.
Resources are not being held on the database server while the application is
being used.
When a DataReader is used for data access, a connection is opened, and the
data is navigated using the Read method. It is not possible to “go back” and read
data that has previously been read, or rather it is not possible to scroll backward
in the data. Because a DataReader is forward-only and read-only, it is useful only
for retrieving the data and is very efficient.You need to realize that during the
scrolling process, resources are being held up on the server.This means that if an
application allows a user to manually navigate in a forward-only manner, the
database is serving the request and waiting.This may result in a resource problem
at the database. It is best to use the DataReader when fast access to the data is
needed, and the entire resultset is being consumed in a relatively short period of
time.This, of course, depends on several variables, such as number of users,
amount of data, hardware availability, and so on.
In both instances, the data is retrieved; however, with the DataSet it is persisted
in a DataTable. As stated earlier, a DataReader is used to populate a
DataTable, so in this regard if a developer needs to access the data once in a forward-
only mode, the DataReader provides a faster mechanism. On the other
hand, if this data is somewhat expensive to create, and it will be used repeatedly,
using a DataSet makes more sense.These are the types of decisions that you will
need to make during the course of designing the application.
The two models are similar in that they both provide data, but that is where
the similarities end.The DataReader provides a stream of data, whereas the
DataSet provides a rich object model with many methods and properties to
interact with the data in any scrolling direction an application would need.

Redth
May 6th, 2003, 12:01 AM
best thing i can think of is to use a stored procedure :/ ...

then you can specify a SELECT starting record, and the pagesize, and it will only return the necessary amount of records.... that's how i'm currently paging a search page for one of my projects, because it can't afford to return ALL records found all the time and hide all but only the one page....

hellswraith
May 6th, 2003, 01:01 AM
That is what I did. I got this great book called ASP.Net Web Data Controls Kick Start by one of the guys at 4guysfromrolla.com

Great book. It had 4 different ways to page data using the datagrid (although you can use a couple of the paging techniques in other ways beside the datagrid if you want).

I ended up picking the stored proceedure and using a DataReader because I needed the speed, and least server resources possible. I also couldn't cache the data because it had the potential to become stale to quick.

Thanks for the reply. To see what I needed it for you can go to my forums that I just created and now are in testing...
www.variantx.com/vxforums/