Help with Using a DataSet in Session State

  • Thread starter Thread starter jaka
  • Start date Start date
J

jaka

Hello... I need some help/advice regarding using a dataset in session state.

When a request first comes to my ASP.NET application, I have code in the Session_Start event to query the user table, which return a dataset. I then add this dataset to a Session variable.

This works, but my questions are:

1. Is storing a dataset in session state the best approach to handle my situation? Or, is there some better alternative? Note that the queried results are user-specific, so application cache wouldn't work.

2. Assuming I go forward with the dataset in session state idea, how do I access an individual element in the data table in the data set that's in the session state variable?

I have this code:

System.Data.DataSet ds = (System.Data.DataSet) Session["reportLogonUser"];

But, then what?

Thanks.
 
jaka said:
Hello... I need some help/advice regarding using a dataset in session
state.

When a request first comes to my ASP.NET application, I have code in the
Session_Start event to query the user table, which return a dataset. I
then add this dataset to a Session variable.

This works, but my questions are:

1. Is storing a dataset in session state the best approach to handle my
situation? Or, is there some better alternative? Note that the queried
results are user-specific, so application cache wouldn't work.

2. Assuming I go forward with the dataset in session state idea, how do
I access an individual element in the data table in the data set that's
in the session state variable?

I have this code:

System.Data.DataSet ds = (System.Data.DataSet) Session["reportLogonUser"];

But, then what?

Thanks.

In my experience dont store datasets in anywhere, get them from the
server every time u need it

store the querying conditions in the session instead
 
Back
Top