How to add Transactions with a DataSet created using the Add Connection Wizard?
Posted
by RoguePlanetoid
on Stack Overflow
See other posts from Stack Overflow
or by RoguePlanetoid
Published on 2010-04-16T10:18:51Z
Indexed on
2010/04/16
10:23 UTC
Read the original article
Hit count: 324
I have a DataSet that I have added to my project where I can Insert and Add records using the Add Query function in Visual Studio 2010, however I want to add transactions to this, I have found a few examples but cannot seem to find one that works with these.
I know I need to use the SQLClient.SQLTransaction Class somehow. I used the Add New Data Source Wizard and added the Tables/View/Functions I need, I just need an example using this process such as How to get the DataConnection my DataSet has used. Assuming all options have been set in the wizard and I am only using the pre-defined adapters and options asked for in this wizard, how to I add the Transaction logic to my Database.
For example I have a DataSet called ProductDataSet with the XSD created for this, I have then added my Stock table as a Datasource and Added an AddStock method with a wizard, this also if a new item calls an AddItem method, if either of these fails I want to rollback the AddItem and AddStock in this case.
© Stack Overflow or respective owner