Thanks for you reply...,
I guess what I'm really trying to figure out is what is the best pratice...,
here's the exact scenario.
The web app we are developing is a portal to a large database.
There will be approximately 1000-1500 hits per day.
The user executes a query which can return at most 1000 records (rowcount is
set to 1000). The results are displayed on a grid with pagination enabled to
100 records per page. Therefore, if the query returns 1000 records, the page
will show the grid with 100 records and links to the other 10 pages. (sorta
like your typical search engine.)
The paging is controlled by the webgrid control, not the stored proc used to
get the data. (ie the stored proc returns the complete result set.)
We are using SQL Server to store our session variables, and the app is
running on a webfarm with 4 servers.
*The requirements are to have the HTML as small as possible, and the limit
the roundtrips to the database.* Therefore, we opted to storing the results
in a session variable, so, when the user clicks on the "page 2" to see more
data, the data is read from the session, instead of being read again from
the database.
So, the question is then, is it better to use a DataTable to keep the data
in session, or use the datareader to populate an array of a custom object?
What are the cost and benefits of either approach? Is there a better
solution?
Looking forward to your response.
"Bruce Johnson" <bj******@spammenot.objectsharp.com> wrote in message
news:uA*************@TK2MSFTNGP12.phx.gbl...
Short answer: It depends.
Longer answer: It depends on what type of session storage you're using.
If you're using in process sessuion, then the difference between the two
is simply the size of the object. If your using a state server or a SQL
server to maintain session information, then you need to look at how the
objects get serialized.
Just so you know, the DataTable will serialize as a diffgram, so the
size used will depend on whether the rows are freshly added (only the
new row is included) or modified (both the new and old rows are
included). ArrayLists, on the other hand serialize as little more than
the aggregated serialization of the objects that are contained.
Hope that helps.
Bruce Johnson [.NET MVP]
http://www.objectsharp.com/blogs/bruce
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!