Stoopid Question

  • Thread starter Thread starter JLW
  • Start date Start date
J

JLW

This is probably a really stoopid q, but I'm planning a multi-user
ASP.NET Data Entry system. Where should I declare the DataSet's and such,
so it's accesable throughout the entire application, and lasts only for the
users session?

Thank You
 
Hi

You might use the ASP.NET's Session state which is user based
Dim ds as new Dataset(
'Code to get datase
Session("myDataset") = d
'Use dataset in any page
CType(Session("myDataset") , Dataset).Tables(0) ...

Bin Song, MCP
 
I agree with Bin. The only thing I may add is that if you are storing a
whole dataset in Session state, don't overdo what you put in it. Session
state is a killer tool and can take some serios stress, but that doesn't
mean take it for granted. I've seen that happen more than a few times with
new ASP.NET developers and if overdone, it can cause some performance
degradation. My point, use as much as you need, but no more than that.
 
So I would declare the dataset in the Glabal.asax under Session_Start, if
I'm understanding. Then, in the Session_End, I don't have to do
anything....

JLW
 
After you load it, immediately afterward (da.Fill(myDataSet) then add it to
session state

Session("SomeNameForTheDataSet") = myDataSet

then to reference it CType(Session("SomeNameForTheDataSet"), DataSet)
 
Using datasets in session state can be pretty costly, as alluded to by
William. Why not create a property that will return the dataset and get it
using the Context.Handler as you move from page to page. In order to do
that, you have to do your page navigation using Server.Transfer rather than
Response.Redirect but there are a lot of other reasons for using
Server.Transfer as well, so that shouldn't be a problem. The dataset
doesn't expire directly with the session but then it doesn't exist if the

Search MSDN for "Passing Values Between Web Forms Pages" for an example of
how to do this. It only takes a couple lines of code on the source page and
the destination page.

Dale
 
Boy, now I've been thrown completly for a loop! Here's my concern, I have a
webapp that uses a dataset, get's the required info, and generates a report.
Well, it seems that there is somekind of memory leak that causes things to
go haywire after a few days. Once I restart IIS and aspnet_wp.exe, things
are fine for a few more days. And I feel I'm going to run into the same
problem here. The prblem, as I'm seeing it, is that I have 2 users, pulling
similar information, not the same, but similar, and things start getting
crossed. This app is going to be a data entry system where numerious poeple
will be entering similar information, and not all of them are necisarrily on
our LAN. I have never seen Context.Handler or Server.Transfer before, I
will have to look deeply into this.

Thank you again,
JLW
 
I may have a solution, all the users are keying into the same structure,
even if it's different data. So, if I can open one common dataset that is
accessable from all sessions, that would solve my problem. Otherwise, I'm
going to eat up ton's of memory. Problem is, is this possible?


Thanks again,
JLW
 
Let me try this approach:

I have 3 pages, Default, KeyApp, and SaveApp.
Default set's up the connectionstring. I am passing that to KeyApp via
Server.Transfer. KeyApp will load a DataSet of about 10,000 records (to
save round-trips to the SQL server). Once the user enteres the record on
KeyApp, it needs to go to SaveApp to do the validation/Saving, then back to
KeyApp. Basically, when the user saves, it needs to go through the records
and see if the info already exists. I probably could do all this on one
page and use some serverside div's, not had much luck with that working in
the past. I am going to look into that route. I was kinda hoping that I
could have a "Common Dataset" that would eliviate the constant loading of
the datasets, but that's the least of my concerns. My other option is to go
to a classic ASO standpoint, take the info the user has entered, and run a
query based off of this to see if the record exists. I'm still 100%
flexible in my designs at this point.

thanks again,
JLW
 
Back
Top