I am trying to create a simple transaction for my Linq-to-Sql actions against my Sql 2000 database. Using TransactionScope is as follows:
using (TransactionScope transaction = new TransactionScope())
{
try
{
Store.DBDataContext dc = new Store.DBDataContext();
Store.Product product = GetProduct("foo");
dc.InsertOnSubmit(product);
dc.SubmitChanges();
transaction.Complete();
}
catch (Exception ex)
{
throw ex;
}
}
However, I keep getting the following error:
Partner Transaction Manager has disabled remote / network transaction support. (Exception from HRESULT: 0x8004D025)
But, if I set up a transaction using a traditional transaction, it works fine. So this works great:
Store.DBDataContext dc = new Store.DBDataContext();
try
{
dc.Connection.Open();
dc.Transaction = dc.Connection.BeginTransaction();
Store.Product product = GetProduct("foo");
dc.InsertOnSubmit(product);
dc.SubmitChanges();
dc.Transaction.Commit();
}
catch (Exception ex)
{
dc.Transaction.Rollback();
throw ex;
}
finally
{
dc.Connection.Close();
dc.Transaction = null;
}
, TransactionScope - , . , , TransactionScope? , , , . , MSDTC sql, .