当前位置: 首页>>代码示例>>C#>>正文


C# OracleClient.OracleTransaction类代码示例

本文整理汇总了C#中System.Data.OracleClient.OracleTransaction的典型用法代码示例。如果您正苦于以下问题:C# OracleTransaction类的具体用法?C# OracleTransaction怎么用?C# OracleTransaction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


OracleTransaction类属于System.Data.OracleClient命名空间,在下文中一共展示了OracleTransaction类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PrepareCommand

        /// <summary>
        /// This method opens (if necessary) and assigns a connection, transaction, command type and parameters 
        /// to the provided command.
        /// </summary>
        /// <param name="command">the OracleCommand to be prepared</param>
        /// <param name="connection">a valid OracleConnection, on which to execute this command</param>
        /// <param name="transaction">a valid OracleTransaction, or 'null'</param>
        /// <param name="commandType">the CommandType (stored procedure, text, etc.)</param>
        /// <param name="commandText">the stored procedure name or PL/SQL command</param> 
        /// <param name="commandParameters">an array of OracleParameters to be associated with the command or 'null' if no parameters are required</param>
        private static void PrepareCommand(OracleCommand command, OracleConnection connection, OracleTransaction transaction, CommandType commandType, string commandText, OracleParameter[] commandParameters)
        {
            //if the provided connection is not open, we will open it
            if (connection.State != ConnectionState.Open)
            {
                connection.Open();
            }

            //associate the connection with the command
            command.Connection = connection;

            //set the command text (stored procedure name or Oracle statement)
            command.CommandText = commandText;
            command.CommandTimeout = 200000;
            //if we were provided a transaction, assign it.
            if (transaction != null)
            {
                command.Transaction = transaction;
            }

            //set the command type
            command.CommandType = commandType;

            //attach the command parameters if they are provided
            if (commandParameters != null)
            {
                AttachParameters(command, commandParameters);
            }

            return;
        }
开发者ID:ChegnduJackli,项目名称:Projects,代码行数:41,代码来源:OracleHelper.cs

示例2: UpdateQCResult

 public bool UpdateQCResult(double loid, DateTime duedate, double qcqty1, double qcqty2, double qcqty3, string qcresult, string qcremark, string userID, string status, OracleTransaction zTrans)
 {
     string sql = "UPDATE PDPRODUCT SET QCRESULT = '" + qcresult + "', ";
     sql += "QCQTY1 = " + qcqty1 + ", ";
     sql += "QCQTY2 = " + qcqty2 + ", ";
     sql += "QCQTY3 = " + qcqty3 + ", ";
     sql += "QCREMARK = '" + qcremark + "', ";
     sql += "PRODSTATUS = '" + status + "', ";
     sql += "QCDUEDATE = " + OracleDB.QRDateTime(duedate) + ", ";
     sql += "UPDATEBY = '" + userID + "', ";
     sql += "UPDATEON = " + OracleDB.QRDateTime() + " ";
     sql += "WHERE LOID = " + loid + " ";
     //+ (status == Constz.Requisition.Status.Approved.Code ? "AND STATUS = '" + Constz.Requisition.Status.Waiting.Code + "' " : (status == Constz.Requisition.Status.Void.Code ? "AND STATUS = '" + Constz.Requisition.Status.Approved.Code + "' " : ""));
     bool ret = true;
     try
     {
         ret = (OracleDB.ExecNonQueryCmd(sql, zTrans) > 0);
         if (!ret) throw new ApplicationException(OracleDB.Err_NoUpdate);
     }
     catch (Exception ex)
     {
         ret = false;
         _error = ex.Message;
     }
     return ret;
 }
开发者ID:SoftSuite,项目名称:ABB,代码行数:26,代码来源:QCAnalysisPDDAL.cs

示例3: Save

 public static int Save(Loan loan, OracleConnection oraDbConn, OracleTransaction oraTrans)
 {
     if(loan.Id == null){
         return Insert(loan, oraDbConn, oraTrans);
     } else {
         return Update(loan);
     }
 }
开发者ID:walbalooshi,项目名称:LoanApplication,代码行数:8,代码来源:LoanDB.cs

示例4: ExecuteNonQuery

 /// <summary>
 /// Execute an OracleCommand (that returns no resultset) against an existing database transaction 
 /// using the provided parameters.
 /// </summary>
 /// <remarks>
 /// e.g.:  
 ///  int result = ExecuteNonQuery(trans, CommandType.StoredProcedure, "PublishOrders", new OracleParameter(":prodid", 24));
 /// </remarks>
 /// <param name="trans">an existing database transaction</param>
 /// <param name="commandType">the CommandType (stored procedure, text, etc.)</param>
 /// <param name="commandText">the stored procedure name or PL/SQL command</param>
 /// <param name="commandParameters">an array of OracleParamters used to execute the command</param>
 /// <returns>an int representing the number of rows affected by the command</returns>
 public static int ExecuteNonQuery(OracleTransaction trans, CommandType cmdType, string cmdText, params OracleParameter[] commandParameters)
 {
     OracleCommand cmd = new OracleCommand();
     PrepareCommand(cmd, trans.Connection, trans, cmdType, cmdText, commandParameters);
     int val = cmd.ExecuteNonQuery();
     cmd.Parameters.Clear();
     return val;
 }
开发者ID:zackwrj,项目名称:B2C_Admin,代码行数:21,代码来源:OracleHelper.cs

示例5: Save

 public static int Save(Applicant applicant, OracleConnection oraDbConn, OracleTransaction oraTrans)
 {
     if (applicant.Id == null) {
         return Insert(applicant, oraDbConn, oraTrans);
     } else {
         return Update(applicant);
     }
 }
开发者ID:walbalooshi,项目名称:LoanApplication,代码行数:8,代码来源:ApplicantDB.cs

示例6: OracleCommandSet

 public OracleCommandSet(OracleConnection connection, OracleTransaction transaction)
 {
     this._usedParameterNames = new Hashtable(StringComparer.OrdinalIgnoreCase);
     this._commandList = new ArrayList();
     this._batchCommand = new OracleCommand();
     this.Connection = connection;
     this.Transaction = transaction;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:OracleCommandSet.cs

示例7: GetDataList

        /// <summary>
        /// Get Data List of This Table
        /// </summary>
        /// <param name="whereCause"></param>
        /// <param name="zTrans">Transaction, set to null if no transaction provided</param>
        /// <returns></returns>
        public DataTable GetDataList(string whereCause, OracleTransaction zTrans)
        {
            string sql = "SELECT PT.* , ";
            sql += "CASE PT.TYPE WHEN '" + Constz.ProductType.Type.FG.Code + "' THEN '" + Constz.ProductType.Type.FG.Rank + "' ";
            sql += "WHEN '" + Constz.ProductType.Type.WH.Code + "' THEN '" + Constz.ProductType.Type.WH.Rank + "' ";
            sql += "WHEN '" + Constz.ProductType.Type.Others.Code + "' THEN '" + Constz.ProductType.Type.Others.Rank + "' ";
            sql += "ELSE '' END AS RANK FROM PRODUCTTYPE PT ORDER BY RANK,PT.CODE";

            return OracleDB.ExecListCmd(sql);
        }
开发者ID:SoftSuite,项目名称:ABB,代码行数:16,代码来源:ProductTypeDAL.cs

示例8: OracleCommand

		public OracleCommand (string commandText, OracleConnection connection, OracleTransaction tx)
		{
			moreResults = -1;
			preparedStatement = null;
			CommandText = commandText;
			Connection = connection;
			Transaction = tx;
			CommandType = CommandType.Text;
			UpdatedRowSource = UpdateRowSource.Both;
			DesignTimeVisible = true;
			parameters = new OracleParameterCollection ();
		}
开发者ID:nlhepler,项目名称:mono,代码行数:12,代码来源:OracleCommand.cs

示例9: FrmSupplierCorrection

        public FrmSupplierCorrection(OracleConnection Conn, OracleTransaction Trans, string strGYSMC)
        {
            string strSQL = "select DWID, DWMC, DWBH, ZJM from JT_J_DWXX";
            OracleDataAdapter ada = new OracleDataAdapter(strSQL, Conn);
            ada.SelectCommand.Transaction = Trans;
            DataSet ds = new DataSet();
            ada.Fill(ds, "JT_J_DWXX");

            InitializeComponent();

            jTJDWXXBindingSource.DataSource = ds;
            jTJDWXXBindingSource.DataMember = "JT_J_DWXX";

            teOldSupplier.Text = strGYSMC;
        }
开发者ID:radtek,项目名称:wxcm-project,代码行数:15,代码来源:FrmSupplierCorrection.cs

示例10: UpdateQCStockinItem

 public bool UpdateQCStockinItem(double stockin, string userID, string status, OracleTransaction zTrans)
 {
     string sql = "UPDATE STOCKINITEM ";
     sql += "SET STATUS = '" + status + "', ";
     sql += "UPDATEBY = '" + userID + "', ";
     sql += "UPDATEON = " + OracleDB.QRDateTime() + " ";
     sql += "WHERE STOCKIN = " + stockin + " ";
     bool ret = true;
     try
     {
         ret = (OracleDB.ExecNonQueryCmd(sql, zTrans) > 0);
         if (!ret) throw new ApplicationException(OracleDB.Err_NoUpdate);
     }
     catch (Exception ex)
     {
         ret = false;
         _error = ex.Message;
     }
     return ret;
 }
开发者ID:SoftSuite,项目名称:ABB,代码行数:20,代码来源:QCAnalysisDAL.cs

示例11: UpdatePDOrder

 public bool UpdatePDOrder(double loid, string userID, string status, OracleTransaction zTrans)
 {
     string sql = "UPDATE PDORDER SET ";
     sql += "STATUS = '" + status + "', ";
     sql += "UPDATEBY = '" + userID + "', ";
     sql += "UPDATEON = " + OracleDB.QRDateTime() + " ";
     sql += "WHERE LOID = " + loid + " ";
     //+ (status == Constz.Requisition.Status.Approved.Code ? "AND STATUS = '" + Constz.Requisition.Status.Waiting.Code + "' " : (status == Constz.Requisition.Status.Void.Code ? "AND STATUS = '" + Constz.Requisition.Status.Approved.Code + "' " : ""));
     bool ret = true;
     try
     {
         ret = (OracleDB.ExecNonQueryCmd(sql, zTrans) > 0);
         if (!ret) throw new ApplicationException(OracleDB.Err_NoUpdate);
     }
     catch (Exception ex)
     {
         ret = false;
         _error = ex.Message;
     }
     return ret;
 }
开发者ID:SoftSuite,项目名称:ABB,代码行数:21,代码来源:QCAnalysisPDDAL.cs

示例12: UpdateQCStockin

 public bool UpdateQCStockin(double loid, string anacode, DateTime anadate, string userID, string status, OracleTransaction zTrans)
 {
     string sql = "UPDATE STOCKIN SET ANACODE = '" + anacode + "', ";
     sql += "STATUS = '" + status + "', ";
     sql += "ANADATE = " + OracleDB.QRDateTime(anadate) + ", ";
     sql += "UPDATEBY = '" + userID + "', ";
     sql += "UPDATEON = " + OracleDB.QRDateTime() + " ";
     sql += "WHERE LOID = " + loid + " ";
     bool ret = true;
     try
     {
         ret = (OracleDB.ExecNonQueryCmd(sql, zTrans) > 0);
         if (!ret) throw new ApplicationException(OracleDB.Err_NoUpdate);
     }
     catch (Exception ex)
     {
         ret = false;
         _error = ex.Message;
     }
     return ret;
 }
开发者ID:SoftSuite,项目名称:ABB,代码行数:21,代码来源:QCAnalysisPDDAL.cs

示例13: ExecuteNonQuery

        internal static bool ExecuteNonQuery(string sql, OracleTransaction trans)
        {
            bool ret = false;
            try
            {
                OracleCommand cmd = new OracleCommand();
                cmd.Connection = trans.Connection;
                cmd.Transaction = trans;
                cmd.CommandText = sql;
                cmd.CommandType = CommandType.Text;
                cmd.CommandTimeout = 240;
                cmd.ExecuteNonQuery();

                ret = true;
            }
            catch (Exception ex)
            {
                ret = false;
            }
            return ret;
        }
开发者ID:TIT-tech,项目名称:OPM_BO,代码行数:21,代码来源:OracleConnectDB.cs

示例14: ExecNonQueryCmd

        public static int ExecNonQueryCmd(string sqlz, OracleTransaction zTrans)
        {
            OracleCommand zCommand = new OracleCommand();

            int retval;

            if (zTrans != null)
            {
                BuildzCommand(zCommand, zTrans.Connection, zTrans, CommandType.Text, sqlz, null);
                retval = zCommand.ExecuteNonQuery();
            }
            else
            {
                using (OracleConnection zConn = new OracleConnection(ConnectionString))
                {
                    BuildzCommand(zCommand, zConn, zTrans, CommandType.Text, sqlz, null);
                    retval = zCommand.ExecuteNonQuery();
                }
            }
            return retval;

        }
开发者ID:SoftSuite,项目名称:ABB,代码行数:22,代码来源:OracleDB.cs

示例15: CreateTransaction

        public bool CreateTransaction()
        {
            bool ret = true;
            try
            {
                if (_Conn == null) { _Conn = OracleDB.GetConnection(); }

                _Trans = _Conn.BeginTransaction(IsolationLevel.ReadCommitted);
            }
            catch (Exception ex)
            {
                ret = false;
                _error = ex.Message;
            }
            if (!ret)
            {
                try
                {
                    if (_Conn != null) { _Conn.Close(); }
                    _Conn.Open();
                    _Trans = _Conn.BeginTransaction(IsolationLevel.ReadCommitted);
                    ret = true;
                }
                catch (Exception ex)
                {
                    ret = false;
                    _error = ex.Message;
                }
            }
            return ret;
        }
开发者ID:SoftSuite,项目名称:ABB,代码行数:31,代码来源:OracleDBObj.cs


注:本文中的System.Data.OracleClient.OracleTransaction类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。