• Upgrade your Internet Experience
  • Sign in
  • Microsoft.com
  • United States (English)
    Brasil (Português)Česká republika (Čeština)Deutschland (Deutsch)España (Español)France (Français)Italia (Italiano)Россия (Русский)대한민국 (한국어)中华人民共和国 (中文)台灣 (中文)日本 (日本語)香港特别行政區 (中文)
 
 
Data Platform Developer Center
 
 
Home
 
 
Library
 
 
Learn
 
 
Downloads
 
 
Support
 
 
Community
 
 
 
Data Platform Developer Center > Data Platform Development Forums > ADO.NET Data Providers > Distributed Transaction Manager
Ask a questionAsk a question
Search Forums:
  • Search ADO.NET Data Providers Forum Search ADO.NET Data Providers Forum
  • Search All Data Platform Development Forums Search All Data Platform Development Forums
  • Search All MSDN Forums Search All MSDN Forums
 

AnswerDistributed Transaction Manager

  • Thursday, July 31, 2008 1:13 PMChirag vm Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Vote As Helpful
    0

    hi to all

    i am developing web application with sqlserver 2005

    i am using subsonic for fatch insert update and delete 

    for any transaction i am using System.Transactions

    this will perfect working only one action will perform

    but when we do mulipal action like 2 record update in different table then it will generate error

    (Network access for Distributed Transaction Manager (MSDTC) has been disabled. Please enable DTC for network access in the security configuration for MSDTC using the Component Services Administrative tool.)

     

    My Code in C# 2.0

     

    int eeplanid = 0;

    int cobradetail_id = 0;

    try

    {

    using (TransactionScope ts = new TransactionScope())

    {

    Tbeeplan objtbeeplans = new Tbeeplan();

    objtbeeplans.EeID = Convert.ToInt32(hdneeid.Value != "" ? hdneeid.Value.ToString() : "0");

    objtbeeplans.PlanID = Convert.ToInt32(ddlplanid.SelectedValue.ToString());

    objtbeeplans.MarkNew();

    objtbeeplans.Save();

    eeplanid = objtbeeplans.EePlanID;

     

    TbEEPlanCOBRADetail objcobradetail= new TbEEPlanCOBRADetail();

    objcobradetail.EePlanID = eeplanid;

    objcobradetail.QbType = Convert.ToInt32(ddlqb_type.SelectedValue.ToString());

    objcobradetail.QeCardinality = Convert.ToInt32(ddlqe_cardinality.SelectedValue.ToString());

    objcobradetail.QeType = Convert.ToInt32(ddlqe_type.SelectedValue.ToString());

    objcobradetail.QeDate = Convert.ToDateTime(txtqe_date.Text.ToString());

    objcobradetail.LocDate = Convert.ToDateTime(txtloc_date.Text.ToString());

    objcobradetail.MarkNew();

    objcobradetail.Save();

    cobradetail_id = objcobradetail.COBRADetailId;

     

    ts.Complete();

    }

    }

    catch (Exception ex)

    {

     

    }

     

     

    • ReplyReply
    • QuoteQuote
     

Answers

  • Thursday, July 31, 2008 3:59 PMNissim Natanov _MSFT_ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Vote As Helpful
    0

    The exception says that you need to enable network access for MSDTC. To enable it:

     

    open Control Panel\Administrative Tools\Component Services

    select Component Services\Computer\My Computer, right-click and choose Properties.
    On the MSDTC tab, press "Security Configuration..." and check if following options are  enabled:

    Network DTC Access

    Under Client and Administration
      Allow Remote Clients
      Allow Remote Administration

    Under Transaction Manager Communication
      Allow Inbound
      Allow Outbound
      No Authentication Required
      Enale XA Transactions

    After that, enable MSDTC application in Windows Firewall, if one is enabled.


    And then reboot your computer and retry.

     

    • ReplyReply
    • QuoteQuote
     

All Replies

  • Monday, August 04, 2008 4:23 PMCaddre Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Vote As Helpful
    0

    (but when we do mulipal action like 2 record update in different table then it will generate error)

     

     

    This is the reason for your error SQL Server is escalating the System.Transaction operation into distributed transaction because you are doing multiple updates in a TransactionScope which makes your operation none atomic so you need a resource manager like MSDTC. 

     

    In SQL Server 2005 you don't need a resource manager if you change your code to one transaction at a time.  You have to decide if you should use Subsonic and use resource manager or drop it and change your code because MSDTC is expensive and not enabled in hosting sites.

     

     

     

    • ReplyReply
    • QuoteQuote
     
Need Help with Forums? (FAQ)
 
© 2009 Microsoft Corporation. All rights reserved.
Terms of Use
|
Trademarks
|
Privacy Statement