Board index » DotNet » Help with public DataSet object in asp.net project

Help with public DataSet object in asp.net project

DotNet286
I'm designing an extranet web site that customer will use to log in and see their account history, make payments against their balance, etc



I've declared a strongly typed DataSet as a public static object in the main accounts page - "public Customer.DataSet dsMyData = new Customer.DataSet();" and populate the tables with information about the account, services, etc which are referenced from the other pages as such: lblEMail.Text = CustScreen.dsMyData.Account[0].EMail;



Everything works great until two customers log in at roughtly the same time. Because the DataSet object is static, the second customer overwrites the DataSet with their account information, at which both customers see the information for the customer who logged in second



Clearly, using a static object isn't going to work in an environment where multiple accounts are logging in at the same time. What would be the correct method for creating a strongly typed dataset that is unique to each asp.net session



Thanks in advance for your help



Andre


-
 

Re:Help with public DataSet object in asp.net project

Store it in Session state. You are right, static variables and modules in

VB.nET (which are basically sealed classes with all shared members) are

shared across the board and can definitely get you in trouble. I did the

exact same thing in the first ASP.NET app I wrote. Worked great in Test,

but as soon as it went live, it was stressful. Fortunately the port from

static variables to Session state was very easy (I was only storing

configuration variables for the user but it still sucked).



Session state isn't the magic bullet and you can definitely overdo it, but

I've used it successfully in this instance for over a year now, and the

tables are usually very small so things are great. However, occassionally

the datatables get quite big, rare but it happens, and everythign still

works quite well.



HTH,



Bill

"Andre Ranieri" <anonymous@discussions.microsoft.com>wrote in message

Quote
I'm designing an extranet web site that customer will use to log in and

see their account history, make payments against their balance, etc.



I've declared a strongly typed DataSet as a public static object in the

main accounts page - "public Customer.DataSet dsMyData = new

Customer.DataSet();" and populate the tables with information about the

account, services, etc which are referenced from the other pages as such:

lblEMail.Text = CustScreen.dsMyData.Account[0].EMail;

Quote


Everything works great until two customers log in at roughtly the same

time. Because the DataSet object is static, the second customer overwrites

the DataSet with their account information, at which both customers see the

information for the customer who logged in second.

Quote


Clearly, using a static object isn't going to work in an environment where

multiple accounts are logging in at the same time. What would be the

correct method for creating a strongly typed dataset that is unique to each

asp.net session?

Quote


Thanks in advance for your help,



Andre





-