As long as you are not waiting for the post-back to do the work.  Every
post-back to the form is a new instance (ASP.NET please correct me if I
am wrong!).  This is what I have observed in my testing.  You could
store it in session state or keep it a static, but as a static, you will
be using the same DataSet for every user.

Thanks,

Shawn Wildermuth
[EMAIL PROTECTED]

> -----Original Message-----
> From: dotnet discussion [mailto:[EMAIL PROTECTED]]
> On Behalf Of Karen Healey
> Sent: Wednesday, May 29, 2002 5:50 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [DOTNET] why does DataSet have to be static meber
>
>
> I'm sure the methods are executing in the correct order. But
> I'm not sure about it being the same instance.  It seems to
> me it should be the same instance but I'm new to this.
>
> I have a multi-panel form (similating multiple pages).  At
> the bottom of one of the last panels made visible, I have a
> finish button.  In the FinishButton_Click method, the current
> panel is hidden, another panel is made visible and the data
> set is built using the data member, dstMaster. Then the user
> is at the new panel and this panel has a submit button (the
> finish button is no longer visible).  When the user clicks on
> the submit button, the SubmitButton_Click method tries to
> access dstMaster and its empty.  Seems like it goes away as
> soon as the code exits the FinishButton_Click method.
>
> So, since this is all one form and no other forms are brought
> up (just a bunch of panels hidden/made visible) then it
> should be the same instance, right?
>
> Thanks,
>
> Karen Healey
> [EMAIL PROTECTED]
>
> ----- Original Message -----
> From: "Ian Griffiths" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, May 29, 2002 16:38
> Subject: Re: [DOTNET] why does DataSet have to be static meber
>
>
> > I have never had any problems using DataSets as non-static
> members.  I
> > suspect that something slightly more subtle is going wrong.
>  Are you
> > absolutely sure that (a) the methods are executing in the order you
> > think they are and (b) that they are actually executing on the same
> > instance
> both
> > times?
> >
> >
> > --
> > Ian Griffiths
> > DevelopMentor
> >
> > ----- Original Message -----
> > From: "Karen Healey" <[EMAIL PROTECTED]>
> >
> > > I've created a class in C# with a DataSet data member
> declared like
> this:
> > >
> > >      private DataSet dstMaster;
> > >
> > > I have a method that builds it by concatenating three datasets
> > > together like this:
> > >
> > >    dstMaster = dstOrg.Copy();
> > >    dstMaster.Merge( dstContact );
> > >    dstMaster.Merge( dstFunding );
> > >
> > > In a SEPARATE method, I try to access the contents of the dataset
> > > but it is empty!
> > >
> > > If I declare the dataset as static, I don't have this problem.  I
> > > don't understand why this is necessary.
> > >
> > > If someone could explain this to me it would be appreciated.
> >
> > You can read messages from the DOTNET archive, unsubscribe from
> > DOTNET, or subscribe to other DevelopMentor lists at
> > http://discuss.develop.com.
> >
>
> You can read messages from the DOTNET archive, unsubscribe
> from DOTNET, or subscribe to other DevelopMentor lists at
> http://discuss.develop.com.
>

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to