DbConnection dbc = database.CreateConnection();
DbTransaction dbtt =
null
;
try
{
dbc.Open();
dbtt = dbc.BeginTransaction();
DbCommand storedProcCommand =
this
.database.GetStoredProcCommand(
"sp_cc_Category_Create"
);
storedProcCommand.Connection = dbc;
storedProcCommand.Transaction = dbtt;
storedProcCommand.ExecuteNonQuery();
DbCommand storedProcCommandnew =
this
.database.GetStoredProcCommand(
"sp_cc_Category_update"
);
storedProcCommandnew .Connection = dbc;
storedProcCommandnew .Transaction = dbtt;
storedProcCommandnew .ExecuteNonQuery();
dbtt.Commit();
}
catch
{
dbtt.Rollback();
}
finally
{
if
(dbc.State == ConnectionState.Open)
dbc.Close();
}