SQL, XML, Nested Datagrids and the like

Discussion in 'ASP .Net' started by David Lozzi, Oct 7, 2005.

  1. David Lozzi

    David Lozzi Guest

    Hello,

    First, I apologize for the cross group posting.

    I have a calendar to create in ASP.Net, using VB. Basically, the calendar
    will display each event, and each event has a list of dates. For Example:

    Event 1
    date1, date2, date3,

    Event 2
    date1, date2, date3

    and so on....

    Here's how I would do it:

    Create the event datagrid and load it with all of the events. Each event
    will have a datagrid within itself and load that with the appropriate dates.
    This works, as I've done it elsewhere, and it looks good. But is it the best
    way? Here's my problem with it. When a user hits this page, there will be
    one request to SQL for the event list, and then individual requests for each
    event to pull the dates. This could reach 15 events for a page, so we're
    looking at 16 queries to SQL just for a single page, PER USER! It just feels
    like a lot of traffic, doesn't it?

    I'm wondering if I can pull the entire single query in XML, then parse and
    read it out as one object, one request, for the entire page. If I can, can
    you provide some sort of guide or tutorial on how to do it. Or some sample
    code. I've worked with some XML (rss and web services) but never had to
    create a datagrid from it. Any help is GREATLY appreciated!

    Thanks a ton!

    --
    David Lozzi
    Web Applications Developer
    dlozzi@(remove-this)delphi-ts.com
    David Lozzi, Oct 7, 2005
    #1
    1. Advertising

  2. David Lozzi

    Frankie Guest

    The "just parse and read it" referring to the XML file might be a lot of
    work... not sure how you'd actually bind your grids to populate them (or if
    you'd have to write a bunch of code to get the data into the grids).

    A more traditional approach, and one that might be more straight-forward,
    would be to load all of your event information into a DataSet (which can be
    thought of as more or less a full-blowd database in memory). The DataSet
    contains individual DataTable objects - possibly explicitly related to each
    other. You can bind your grids to those DataTables as necessary. To get away
    from a bunch of DB hits you could populate your dataSet and then stick it in
    the Cache object. The next user comes along and you retrieve the data from
    the cached DataSet (no hit against the DB). This would be one possible way
    that might make sense if the underlying data changes infrequently.

    Just remember that the Cache can get blown away by the system as necessary -
    so you'd have to have logic that first attempts to find the DataSet in the
    Cache... uses it if it's there... otherwise hits the db to populate it (then
    sticks it into the Cache for possible future use). You'd also have to have
    some way to refresh the data in the Cache when the data in the underlying db
    changes.

    -HTH




    "David Lozzi" <> wrote in message
    news:...
    > Hello,
    >
    > First, I apologize for the cross group posting.
    >
    > I have a calendar to create in ASP.Net, using VB. Basically, the calendar
    > will display each event, and each event has a list of dates. For Example:
    >
    > Event 1
    > date1, date2, date3,
    >
    > Event 2
    > date1, date2, date3
    >
    > and so on....
    >
    > Here's how I would do it:
    >
    > Create the event datagrid and load it with all of the events. Each event
    > will have a datagrid within itself and load that with the appropriate
    > dates. This works, as I've done it elsewhere, and it looks good. But is it
    > the best way? Here's my problem with it. When a user hits this page, there
    > will be one request to SQL for the event list, and then individual
    > requests for each event to pull the dates. This could reach 15 events for
    > a page, so we're looking at 16 queries to SQL just for a single page, PER
    > USER! It just feels like a lot of traffic, doesn't it?
    >
    > I'm wondering if I can pull the entire single query in XML, then parse and
    > read it out as one object, one request, for the entire page. If I can, can
    > you provide some sort of guide or tutorial on how to do it. Or some sample
    > code. I've worked with some XML (rss and web services) but never had to
    > create a datagrid from it. Any help is GREATLY appreciated!
    >
    > Thanks a ton!
    >
    > --
    > David Lozzi
    > Web Applications Developer
    > dlozzi@(remove-this)delphi-ts.com
    >
    >
    >
    >
    Frankie, Oct 7, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Juliano Bortolozzi

    Re: Nested Datagrids

    Juliano Bortolozzi, Jul 14, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    419
    Juliano Bortolozzi
    Jul 14, 2003
  2. Dave

    Nested DataGrids

    Dave, Jul 15, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    613
    S. Justin Gengo
    Jul 15, 2003
  3. Dave

    Nested DataGrids

    Dave, Jul 21, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    386
    Ray Dixon [MVP]
    Jul 21, 2003
  4. Ultrus
    Replies:
    3
    Views:
    361
    Stefan Behnel
    Jul 9, 2007
  5. subha

    Editing in nested datagrids - ASP.NET and VB

    subha, Jul 10, 2003, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    110
    subha
    Jul 10, 2003
Loading...

Share This Page