sqlconnection does not support parallel transaction

ล็อกแล้ว sqlconnection does not support parallel transaction

  • 24 พฤศจิกายน 2552 7:23
     
      มีโค้ด
    refer:http://social.microsoft.com/Forums/en-US/uklaunch2007ado.net/thread/9a32241c-790b-4be7-8230-07deef9ad798?prof=required

    I could not still able to identify the problem.

    when I get applychanges() at client  immediately end transaction calls and   in the bool variable commit i get false and the exception occurs
    <pre lang="x-c#">    public class SQLExpressClientSyncProvider:ClientSyncProvider
        {
    
            private DbServerSyncProvider _dbSyncProvider;
            private Guid _clientId;
    
            private int _refCntSession;
            private IDbTransaction _transaction;
    
            private const string GuidTableName = "guid";
            private const string AnchorTableName = "anchor";
            public event EventHandler<ApplyChangeFailedEventArgs> ApplyChangeFailed;
    
            public SQLExpressClientSyncProvider()
            {
                _dbSyncProvider = new DbServerSyncProvider();
                _refCntSession = 0;
                _transaction = null;
              
            }
    <pre lang="x-c#">  public override void BeginTransaction(SyncSession syncSession)
            {
                _refCntSession++;
                if (Connection.State == ConnectionState.Closed)
                {
                    Connection.Open();
                }
                if (_transaction == null)
                {
                    
                    _transaction = _dbSyncProvider.Connection.BeginTransaction();
                }
            }
    
    _
    <pre lang="x-c#">   public override void EndTransaction(bool commit, SyncSession syncSession)
            {
    
                _refCntSession--;
                if (_refCntSession == 0)
                {
                    if (commit)
                        _transaction.Commit();
                    else
                        _transaction.Rollback();
    
                    _transaction.Dispose();
                    _transaction = null;
    
                    Connection.Close();
                }
                if (_refCntSession < 0) _refCntSession = 0;
                //else if (_refCntSession < 0)
                //    throw new SyncException("Transaction error: _refCntSession < 0");
            }


    Thanks, Bharathi
    • ย้ายโดย Max Wang_Chinasoft 21 เมษายน 2554 22:30 forum consolidation (From:SyncFx - Microsoft Sync Framework Database Providers [ReadOnly])
    •  

ตอบทั้งหมด

  • 28 พฤศจิกายน 2552 5:40
    เจ้าของ
     
     คำตอบ
    I think there is another thread from you in this forums that is tracking the same issue. We should probably use that to track further.


    This posting is provided AS IS with no warranties, and confers no rights