Managing Distributed Transactions with ADO.NET 2.0 using TransactionScope gives error message
Hi,
I am working on vs2005 with sql server 2000. I have used TransactionScope class.
Example Reference:
http://www.c-sharpcorner.com/UploadFile/mosessaur/TransactionScope04142006103850AM/TransactionScope.aspx
The code is given below.
using System.Transactions;
protected void Page_Load(object sender, EventArgs e)
{
System.Transactions.TransactionOptions transOption = new System.Transactions.TransactionOptions();
transOption.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
transOption.Timeout = new TimeSpan(0, 2, 0);
using (System.Transactions.TransactionScope tranScope = new System.Transactions.TransactionScope(TransactionScopeOption.Required,transOption))
{
using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["nwConnString"].ConnectionString))
{
int i;
con.Open();
SqlCommand cmd = new SqlCommand("update products set unitsinstock=100 where productid=1", con);
i = cmd.ExecuteNonQuery();
if (i > 0)
{
using (SqlConnection conInner = new SqlConnection(ConfigurationManager.ConnectionStrings["pubsConnString"].ConnectionString))
{
conInner.Open();
SqlCommand cmdInner = new SqlCommand("update Salary set sal=5000 where eno=1", conInner);
i = cmdInner.ExecuteNonQuery();
if (i > 0)
{
tranScope.Complete();
}
}
}
}
}
}
It gives error like
"The partner transaction manager has disabled its support for remote/network transactions. (Exception from HRESULT: 0x8004D025)"
The database I have used is northwind database and pubs database which is by default in sql server 2000.
So, Kindly let me know how to proceed further.
Thanks in advance,
Arun.