User-635215137 posted
Hi:
I am using sqlHelper to communicate with database, very handy.
I want to use Transaction to make sure all the data will be removed for a particula user. So I will use:
1. Membership.DeleteUser(sUserName)
2. Delete other related data in other tables .
I want to make sure both 1 and 2 will be executed successfully, otherwise don't delete any data.
Since I am using sqlHelper, I don't know where and how to use the transaction functions.
I have googled for the help, most of them are using(such as below): Command.transaction..., but I am using sqlHelper, so I don't know how to archive it
SqlTransaction myTransaction = null;
myTransaction =myConnection.BeginTransaction();
myCommand.Transaction = myTransaction;
catch (Exception ex)
{
string exception = ex.Message;
myTransaction.Rollback();
}
Thanks
JT