hi,
I you need to use the transaction. try as below.
SqlTransaction objTran;
SqlConnection _SqlCOnn = new SqlCOnnection("COnnection String");
SqlCommand _SqlCmd = new SqlCommand();
_SqlCOnn.Open();
for(int i=0;i<empids.count;i++)>
{
objTran = _SqlCOnn.BeginTransaction(IsolationLevel.RepeatableRead);
_SqlCmd.Transaction=objTran;
try
{
insert in to first table
foreach (DataRow EmpDetails in m_oDataSet.Tables["Details"].Rows)
{
insert in to second table
objTran.Commit();
}
}
catch(Exception ex)
{
objTran.RollBack();
}
}
So, This will commit/rollback the particular transaction. It would't not affect the previous commited transactions.
hope this helps.