开发者

Where should I store a data table [ViewState/ Session/ Cache]

开发者 https://www.devze.com 2022-12-27 11:18 出处:网络
I have a DataTable with about 10,000 rows in it. I would like to开发者_如何学C store this data once for aspx page. When the user selects different options in the page, data is further selected from

I have a DataTable with about 10,000 rows in it.

I would like to开发者_如何学C store this data once for aspx page. When the user selects different options in the page, data is further selected from the already stored DataTable.

I tried using the ViewState, but as soon as the data grows beyond 100 rows, performance degrades.

Where should I store this data?


Is the data on a per-user basis or is it global for all users? If it's global, use Cache. If it's user-specific, the traditional answer is to use Session, but that's a potential memory usage problem waiting to happen. You might just have to requery the database as needed.

ViewState has a more specific use, and it not suitable for large amounts of data, since all of that data is sent between the client and server in the webpage.


I bet you must not be displaying all data together.

Why don't you use paging and load only required set of data and then keep on adding to session object, fetch first say 50 records display it and then on next page click fetch next set of 50 records.

You can use SP for this purpose http://www.mssqltips.com/sqlservertip/1699/sql-server-stored-procedures-to-page-large-tables-or-queries/

0

精彩评论

暂无评论...
验证码 换一张
取 消