Home All Groups Group Topic Archive Search About
Author
14 Feb 2006 5:35 AM
Charles
I would appreciate some help, or direction, in understanding two things
about using the DataAdapter's update method.  The first issue I have is
the DataAdapter and Table need to be declared in the same procedure as
the three commands.  Usally, this is done at the begining of a Web Form
to display data.  Unless I am doing something wrong, once you leave
that procedure you loose those declarations.  Since you send updates
back to the data source at the end you would need to maintain the
declarations.  It seems that using a session variable would not be a
good idea because the session is likely to time out.  If you use public
variables you are going to end up with a lot varables.

The second area is using the insert, delete and upate commands from a
stored procedure.  I cannot seem to find any clear documentation on how
do this.

Again, I would really appreciate some feedback on this.

Thanks
Charles

Author
14 Feb 2006 2:44 PM
W.G. Ryan - MVP
Charles:

They don't need to be declared in the same method, function class or even
assembly and often aren't. If you're using the autogenerated tools then it
does it in the UI layer but as a general rule, it's something that should be
avoided. MSN Search for Data Access Application Block, seeing how this was
constructed should shed a lot of light on your current situation

To use a Stored Procedure, you need to set the Command's CommandType to
Stored Procedure and then just use the proc name as the Command Text. Then
add parameters if there are any.  This should help
http://www.c-sharpcorner.com/Code/2003/Jan/InsOutsinCS.asp
Show quote
"Charles" <cba***@bjtsupport.com> wrote in message
news:1139895312.168378.117390@g14g2000cwa.googlegroups.com...
>I would appreciate some help, or direction, in understanding two things
> about using the DataAdapter's update method.  The first issue I have is
> the DataAdapter and Table need to be declared in the same procedure as
> the three commands.  Usally, this is done at the begining of a Web Form
> to display data.  Unless I am doing something wrong, once you leave
> that procedure you loose those declarations.  Since you send updates
> back to the data source at the end you would need to maintain the
> declarations.  It seems that using a session variable would not be a
> good idea because the session is likely to time out.  If you use public
> variables you are going to end up with a lot varables.
>
> The second area is using the insert, delete and upate commands from a
> stored procedure.  I cannot seem to find any clear documentation on how
> do this.
>
> Again, I would really appreciate some feedback on this.
>
> Thanks
> Charles
>
Author
15 Feb 2006 8:36 AM
Charles
W.G. Ryan - MVP wrote:
Show quote
> Charles:
>
> They don't need to be declared in the same method, function class or even
> assembly and often aren't. If you're using the autogenerated tools then it
> does it in the UI layer but as a general rule, it's something that should be
> avoided. MSN Search for Data Access Application Block, seeing how this was
> constructed should shed a lot of light on your current situation
>
> To use a Stored Procedure, you need to set the Command's CommandType to
> Stored Procedure and then just use the proc name as the Command Text. Then
> add parameters if there are any.  This should help
> http://www.c-sharpcorner.com/Code/2003/Jan/InsOutsinCS.asp
> "Charles" <cba***@bjtsupport.com> wrote in message
> news:1139895312.168378.117390@g14g2000cwa.googlegroups.com...
> >I would appreciate some help, or direction, in understanding two things
> > about using the DataAdapter's update method.  The first issue I have is
> > the DataAdapter and Table need to be declared in the same procedure as
> > the three commands.  Usally, this is done at the begining of a Web Form
> > to display data.  Unless I am doing something wrong, once you leave
> > that procedure you loose those declarations.  Since you send updates
> > back to the data source at the end you would need to maintain the
> > declarations.  It seems that using a session variable would not be a
> > good idea because the session is likely to time out.  If you use public
> > variables you are going to end up with a lot varables.
> >
> > The second area is using the insert, delete and upate commands from a
> > stored procedure.  I cannot seem to find any clear documentation on how
> > do this.
> >
> > Again, I would really appreciate some feedback on this.
> >
> > Thanks
> > Charles
> >
William,
This is what I was looking for!  Thanks for the information.
Charles

AddThis Social Bookmark Button