DataSet Problem

  • Thread starter Thread starter Loy Castelino
  • Start date Start date
L

Loy Castelino

Hi All,


I have the particular code in the code page of a C# form.

namespace StyleCraft
{
public class wf_CabDef : System.Web.UI.Page
{
<Variable declared along with form controls.>
protected DataSet oDataSet1 ;

private void Page_Load(object sender, System.EventArgs e)
{
if (!Page.IsPostBack)
{
oDataSet1 = new DataSet();
<Put data into the dataset.>
}
}
}
}

I need to store data in the dataset at runtime without saving it into
the backend during the intermediate stage. The data will be saved into
the backend only on the final save.
This code works fine when only one person is running the web
application.
But when two persons are running the application then when the second
person start the particular page the Dataset of the first user is lost
and it can no longer be accessed by the system.

I have tried the following ways to define the dataset.

protected static DataSet oDataSet1 ;
private static DataSet oDataSet1 ;
private DataSet oDataSet1 ;

even removed the reintializing from the Page_Load method. But this
created another problem wherein when the first user refreshed his page
the data of the second user was visible to him.

A little bit stymied what to do about this.
Please tell what i'm doing wrong.

Thanx in advance.

Loy
 
You might want to look into Session objects. You could store the dataset
as a session object and it would be unique for each user.
 
I agree with Morten. That way you keep your dataset private, but can still
persist it between page calls.

Marco
 
Back
Top