|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
DataAdapter Commandsabout 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 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 > W.G. Ryan - MVP wrote:
Show quote > Charles: This is what I was looking for! Thanks for the information.> > 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, Charles |
|||||||||||||||||||||||