0

In my project everywhere I get data(ex.customers) in a datatable and for further use I store it in session as

Session.Add("DtTblName",dt_Cust);

And access through dt_Cust=(DataTable) Session["DtTblName"];

All is working fine, my concern is, Is it a right way to store heavy object like datatable store in session, to avoid database access?
What happen if little bit more website users will have their own sessions?

IF this way is correct tell me as, if not please suggest other way with little justification.

2
Contributors
2
Replies
4
Views
6 Years
Discussion Span
Last Post by Nitin Daphale
0

In my project everywhere I get data(ex.customers) in a datatable and for further use I store it in session as

Session.Add("DtTblName",dt_Cust);

And access through dt_Cust=(DataTable) Session["DtTblName"];

All is working fine, my concern is, Is it a right way to store heavy object like datatable store in session, to avoid database access?
What happen if little bit more website users will have their own sessions?

IF this way is correct tell me as, if not please suggest other way with little justification.

DataTable Tissues = new DataTable();

Tissues = dal.returnTissues("TestID", "TestValue");// returnTissues("","") sample function for adding values

Session.Add("Tissues", Tissues);

Retrive that datatable from session: DataTable Tissues = Session["Tissues"] as DataTable

or

DataTable Tissues = (DataTable)Session["Tissues"];

0

DataTable Tissues = new DataTable();

Tissues = dal.returnTissues("TestID", "TestValue");// returnTissues("","") sample function for adding values

Session.Add("Tissues", Tissues);

Retrive that datatable from session: DataTable Tissues = Session["Tissues"] as DataTable

or

DataTable Tissues = (DataTable)Session["Tissues"];

Hi crishlay, I think you have misunderstood my question!

I know how to store datatable in session and how to retrieve it from session again.

I asked, we use sessions to avoid DB transactions but it is a right way when website storing huge amount of data in session? (ex. datatable having 200 rows.)

Edited by Nitin Daphale: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.