DataAdapter Commands

C

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
 
W

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
 
C

Charles

W.G. Ryan - MVP said:
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
William,
This is what I was looking for! Thanks for the information.
Charles
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top