Exemple #1
0
        public int ExecNonQuery(string commandID, params object[] parameters)
        {
            string      cmdText     = GetCommandText(commandID);
            CommandType commandType = GetCommandType(commandID);

            OracleParameter[] param = ConvertParam(parameters, ref cmdText, commandType);
            Util.Log.Debug(GetNoParamCommandText(commandID, cmdText, param));

            return(ORACLEHelper.ExecuteNonQuery(ConnectionString, commandType, cmdText, param));
        }
Exemple #2
0
        public int ExecTran(string[] commandIDs, List <object[]> parameters)
        {
            int retval = 0;

            using (OracleConnection connection = new OracleConnection(ConnectionString))
            {
                connection.Open();
                OracleTransaction transaction = connection.BeginTransaction();
                try
                {
                    for (int i = 0; i < commandIDs.Length; i++)
                    {
                        string            cmdText     = GetCommandText(commandIDs[i]);
                        CommandType       commandType = GetCommandType(commandIDs[i]);
                        OracleParameter[] param       = (parameters == null ? null : ConvertParam(parameters[i], ref cmdText, commandType));

                        Util.Log.Debug(GetNoParamCommandText(commandIDs[i], cmdText, param));

                        int ret = ORACLEHelper.ExecuteNonQuery(transaction, GetCommandType(commandIDs[i]), cmdText, param);
                        retval = retval + ret;
                    }
                    transaction.Commit();
                    if (connection.State == ConnectionState.Open)
                    {
                        connection.Close();
                    }
                }
                catch (Exception ex)
                {
                    retval = 0;
                    transaction.Rollback();
                    if (connection.State == ConnectionState.Open)
                    {
                        connection.Close();
                    }
                    throw ex;
                }
            }

            return(retval);
        }