예제 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="ts"></param>
        /// <returns></returns>
        public int FbExecuteTransaction(TransactionSetCollection ts)
        {
            int rowAffect = 0;

            //OpenFbData();
            //_tran = _con.BeginTransaction();
            try
            {
                foreach (TransactionSet t in ts)
                {
                    //com = new FbCommand(t.SqlCommand, con);
                    //com.Transaction = trans;
                    _com = GetCommandDb(t.SqlCommand, CommandType.Text);

                    if (t.Parameter != null)
                    {
                        SetParameter(t.Parameter, ref _com);
                    }
                    rowAffect += _com.ExecuteNonQuery();
                }
                //_tran.Commit();
                //CommitTransaction();
            }
            catch (Exception ex)
            {
                //_tran.Rollback();
                //RollBackTransaction();
                _gloEx    = ex;
                rowAffect = 0;
            }
            finally
            {
                //CloseFbData();
                //DisposeAll();
            }


            if (_gloEx != null)
            {
                throw _gloEx;
            }

            return(rowAffect);
        }
예제 #2
0
        public int FbExecuteNonQuery(TransactionSetCollection ts)
        {
            int rowAffect = 0;

            try
            {
                OpenFbData();
                foreach (TransactionSet t in ts)
                {
                    //com = new FbCommand(t.SqlCommand, con);
                    //com.Transaction = trans;

                    _com = GetCommandDb(t.SqlCommand, t.ExecuteType);

                    if (t.Parameter != null)
                    {
                        SetParameter(t.Parameter, ref _com);
                    }
                    rowAffect += _com.ExecuteNonQuery();
                }
                //trans.Commit();
            }
            catch (Exception ex)
            {
                // trans.Rollback();
                _gloEx    = ex;
                rowAffect = 0;
            }
            finally
            {
                CloseFbData();
                DisposeAll();
            }


            if (_gloEx != null)
            {
                throw _gloEx;
            }

            return(rowAffect);
        }