locked
sqlconnection does not support parallel transaction RRS feed

  • Question

  • 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
    • Moved by Max Wang_1983 Thursday, April 21, 2011 10:30 PM forum consolidation (From:SyncFx - Microsoft Sync Framework Database Providers [ReadOnly])
    Tuesday, November 24, 2009 7:23 AM

Answers