Storing a datatable in application or session state?

J

Jason

Is it possible to store an entire datatable/dataset in session state? If
so, could someone please provide a code snippet or a link to documentation
for me please? (I'm having no luck at all)

Thanks very much in advance,

Jason
 
S

Steve C. Orr [MVP, MCSD]

A DataSet can hold an entire database, and you can stick a whole DataSet
into session state if you choose.
Be careful though, this can eat a lot of server memory if you have very many
users.
 
J

Jason

Actually, I said session state but meant viewstate. If I use viewstate,
would I have to serialize then deserialize the dataset? Could I use
viewstate the same way as session state basically? I'm having much more
luck with session state rather than viewstate which is why I'm asking,
perhaps I'm missing a fundamental understanding of the difference between
viewstate and session state. I thought simply that one is for server and
one is client side...
 
S

Steve C. Orr [MVP, MCSD]

You should be able to use ViewState the same way.
DataSets are serializable by default.

ViewState("MyDataSet") = MyDataSet

This will add significant size to your page of course.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
 
T

Tina

just lurking this thread. I do this frequently and was wondering if it is
possible to get any reporting on the size of all of the session state
objects on a web server.
TIA,
T
 
S

Steve C. Orr [MVP, MCSD]

You can get a rough idea by watching the free RAM in the windows performance
monitor during various tests.
If you want to get more formal you can also interact with these metrics from
code at runtime.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
 
K

Ksenia

is it possible to pass the session between asp.net applications located on 2 different servers? I have a page that collects data and populates a very tiny table. Then I want to pass that table to another application and be able to read the data in the fields. Is there a way to do it? I tried, but get an empty object or session - says: Object reference not set to an instance of an object. help:(

From http://www.developmentnow.com/g/8_2...datatable-in-application-or-session-state.htm

Posted via DevelopmentNow.com Groups
http://www.developmentnow.com
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,480
Members
44,900
Latest member
Nell636132

Latest Threads

Top