Example #1
0
 internal static void ExecuteCommand(OracleCommand command)
 {
     using (command)
     {
         command.Connection = OracleConnectionService.conn;
         OracleConnectionService.OpenDatabaseConnect();
         command.ExecuteNonQuery();
         OracleConnectionService.CloseDatabaseConnect();
     }
 }
Example #2
0
 internal static void Insert(string Sql)
 {
     using (OracleCommand command = new OracleCommand(Sql))
     {
         command.Connection = OracleConnectionService.conn;
         OracleConnectionService.OpenDatabaseConnect();
         command.ExecuteNonQuery();
         OracleConnectionService.CloseDatabaseConnect();
     }
     //LogService.Log($"[INFO] {MethodBase.GetCurrentMethod().DeclaringType} {MethodBase.GetCurrentMethod().Name}", 2);
 }
Example #3
0
        internal static void Insert(List <string> Sqls)
        {
            int c = Sqls.Count();

            for (int i = 1; i <= c; ++i)
            {
                using (OracleCommand command = new OracleCommand(Sqls[i - 1]))
                {
                    command.Connection = OracleConnectionService.conn;
                    OracleConnectionService.OpenDatabaseConnect();
                    command.ExecuteNonQuery();
                    OracleConnectionService.CloseDatabaseConnect();
                }
            }
            //LogService.Log($"[INFO] {MethodBase.GetCurrentMethod().DeclaringType} {MethodBase.GetCurrentMethod().Name}", 2);
        }
Example #4
0
        /// <summary>
        /// Запускает одиночный запрос
        /// </summary>
        /// <param name="Sql">Запрос</param>
        /// <returns>DataTable с резльтатом запроса</returns>
        internal static DataTable Select(string Sql)
        {
            DataTable DataGridItems = ObjToDataTable(typeof(string));

            using (OracleCommand command = new OracleCommand())
            {
                command.Connection = OracleConnectionService.conn;
                OracleConnectionService.OpenDatabaseConnect();
                OracleDataAdapter    adapter = new OracleDataAdapter(Sql, OracleConnectionService.conn);
                OracleCommandBuilder builder = new OracleCommandBuilder(adapter);
                DataGridItems.Clear();
                adapter.Fill(DataGridItems);
                OracleConnectionService.CloseDatabaseConnect();
            }

            //LogService.Log($"[INFO] {MethodBase.GetCurrentMethod().DeclaringType} {MethodBase.GetCurrentMethod().Name}", 2);
            return(DataGridItems);
        }