Hi
protected void Button1_Click(object sender, EventArgs e)
{
TransactionScope scope= new TransactionScope();
try
// Create the TransactionScope to execute the commands, guaranteeing
// that both commands can commit or roll back as a single unit of work.
using (scope )
EMPTEST();
EMPNAME();
// The Complete method commits the transaction. If an exception has been thrown,
// Complete is not called and the transaction is rolled back.
scope.Complete();
}
catch (TransactionAbortedException ex)
Debug.WriteLine("TransactionAbortedException Message: {0}", ex.Message);
catch (ApplicationException ex)
Debug.WriteLine("ApplicationException Message: {0}", ex.Message);
catch (IITBookKeeping.ExceptionBookKeeping ex)
finally
scope.Dispose();
Debug.WriteLine("Transaction Complete");
private void EMPNAME()
EMPNAMEBO name = new EMPNAMEBO();
name.CreateUser =
"Test";
name.CreateDateTime =
DateTime.Now;
name.dbName =
ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
name.id = 4;
name.name =
"Khaleel";
EMPNAMETO nameTx = new EMPNAMETO();
EMPNAMEBO name1 = new EMPNAMEBO();
name1 = nameTx.Add(name);
private void EMPTEST()
EMPTESTBO test = new EMPTESTBO();
test.CreateUser =
test.CreateDateTime =
test.dbName =
test.Emp_name =
"khaleel";
test.Emp_Sal =
Convert.ToDecimal(10.2f);
EMPTESTBO test2 = new EMPTESTBO();
EMPTESTTO testTx = new EMPTESTTO();
test2 = testTx.Add(test);