Results 1 to 5 of 5

Thread: Paging data for presentation

  1. #1

    Thread Starter
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464

    Paging data for presentation

    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 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?

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    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/de...achingarch.asp

  3. #3
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474
    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.
    'Heading for the automatic overload'
    Marillion, Brave, The Great Escape, 1994

    'How will WE stand the FIRE TOMORROW?'
    Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979

  4. #4
    Fanatic Member Redth's Avatar
    Join Date
    May 2001
    Location
    Ontario, Canada
    Posts
    551
    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....

  5. #5

    Thread Starter
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    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/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width