I have te following,
at the execution i have the following error after the first execution of the 'for statement' "Invalid MSDTC on server MarcelleNGOUNOU\SQLEXPRESS is unavailable for prameter MachineName"
and its move to transaction.complete but did not rollback!
thanks for your help
private void Cmd_PrintFichRensRPT_Click(object sender, EventArgs e)
{
bool MAJ = false;
if (DTGVFicheRensRPT.RowCount != 0)
{
using (TransactionScope transaction = new TransactionScope())
{
try
{
for (int l = 0; l <= DTGVFicheRensRPT.RowCount - 1; l++)
{
string DosID = DTGVFicheRensRPT.Rows[l].Cells[8].Value.ToString();
//MAJ
MAJ = ExecuteRequete.ExecuteStoredProcedure("MAJStatutDossier", new SqlParameter("@StaId", 11), new SqlParameter("@DosID", DosID),
new SqlParameter("@staBL", null), new SqlParameter("@staCRprod", null));
}
}
catch (Exception Message)
{
MessageBox.Show(Message.ToString());
}
// Valider la transaction
transaction.Complete();
}
if (MAJ )
{
CRV_FichRensRPT.PrintReport();
UtilsProcFunc.Edition(this, 1);
}
else
{ UtilsProcFunc.Edition(this, 1); }
}
else
{
}
} at the execution i have the following error after the first execution of the 'for statement' "Invalid MSDTC on server MarcelleNGOUNOU\SQLEXPRESS is unavailable for prameter MachineName"
and its move to transaction.complete but did not rollback!
I don't understand this error
thanks for your help
Jignesh TrivediPosted Aug 29, 2012, 5:41 AM
Jignesh TrivediPosted Aug 28, 2012, 11:43 PM
when you use Trancation scope, at this time you must enable MSDTC service on SQL server machine.
Please refer..
http://technet.microsoft.com/en-us/library/cc759136%28v=ws.10%29.aspx
http://blogs.msdn.com/b/angelsb/archive/2004/07/06/174215.aspx
hope this will help you.
marcelle ngounouPosted Aug 29, 2012, 5:35 AM