Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            QuerySelectOracle q=new QuerySelectOracle();
            q.Select("select username, status, program, machine from gv$session where username is not null");
            List<DataRows> rows = q.GetRows();
            listView1.Items.Clear();
            foreach (DataRows row in rows)
            {
                //listView1.Items.Add("Имя пользователя : " + row.FieldByName("username") + ";   Статус : " + row.FieldByName("status") + ";   Программа : " + row.FieldByName("program") + ";   Компьютер :  " + row.FieldByName("machine"));
                ListViewItem item = new ListViewItem(row.FieldByName("username"));
                item.SubItems.Add(row.FieldByName("status"));
                item.SubItems.Add(row.FieldByName("program"));
                item.SubItems.Add(row.FieldByName("machine"));
                listView1.Items.Add(item);

            }
        }
 public override void Run()
 {
     /// это пример использования
     /// Считали данные из таблицы
     /// Формируем для каждого изменения соответствующую  отмену
     // заполняем
     if (Running)
     {
         string predsost = "select idGU, offGU, offText from UserBM";
         QuerySelectOracle q = new QuerySelectOracle();
         QueryExecOracle qe = new QueryExecOracle();
         q.Select(predsost);
         List<DataRows> lst = q.GetRows();
         foreach (DataRows rows in lst)
         {
             UserInfo userInfo = new UserInfo();
             userInfo.idGU = int.Parse(rows.FieldByName("idGU"));
             userInfo.offGU = int.Parse(rows.FieldByName("offGu"));
             userInfo.offText = rows.FieldByName("offText");
             FinallyStack.Add(RestoreUser, userInfo);
         }
         string running = "update UserBM set offGU=1, offText='Идет импорт'";
         qe.Execute(running);
         // Удалять все сеансы кроме SYSTEM
         string showsessions = "SELECT s.sid,s.serial#,s.osuser,s.program FROM v$session s";
         q.Select(showsessions);
         lst = q.GetRows();
         foreach (DataRows rows in lst)
         {
             if(rows.FieldByName("osuser")!="SYSTEM")
             {
                 string kill = "ALTER SYSTEM KILL SESSION '"+rows.FieldByName("sid")+","+rows.FieldByName("serial#")+"' IMMEDIATE";
                 qe.Execute(kill);
             }
         }
         //Реконнект
         DataBaseOracle.Disconnect();
         DataBaseOracle.Get();
     }
 }
Beispiel #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            string SQL = "select tableName from Transfer2PDA";
            QuerySelectPDA query=new QuerySelectPDA();
            query.Select(SQL);
            List<DataRows> rows = query.GetRows();
            PDATables.Items.Clear();

            foreach (DataRows row in rows)
            {
                PDATables.Items.Add(row.FieldByName("tableName"));
            }

            SQL = "select distinct Table_Name from user_tables";
            QuerySelectOracle Oraquery=new QuerySelectOracle();
            Oraquery.Select(SQL);
            rows = Oraquery.GetRows();
            OraTables.Items.Clear();
            foreach (DataRows row in rows)
            {
                if (!PDATables.Items.Contains(row.FieldByName("Table_Name")))
                OraTables.Items.Add(row.FieldByName("Table_Name"));
            }
        }
Beispiel #4
0
        private void PDATables_SelectedIndexChanged(object sender, EventArgs e)
        {
            string SQL = "select * from Transfer2PDA where tableName='{0}'";
            QuerySelectPDA query = new QuerySelectPDA();
            query.Select(String.Format(SQL,PDATables.SelectedItem));
            List<DataRows> rows = query.GetRows();
            if (rows.Count > 0)
            {
                if (rows[0].FieldByName("isLight") == "1") checkBox1.Checked = true;
                else checkBox1.Checked = false;
                if (rows[0].FieldByName("needExport") == "1") checkBox2.Checked = true;
                else checkBox2.Checked = false;
                textBox1.Text = rows[0].FieldByName("idTransferTable");

                SQL = "select fieldname from TransferFields where idTransferTable={0}";
                query.Select(String.Format(SQL, textBox1.Text));
                List<DataRows> rows1 = query.GetRows();
                PDAFields.Items.Clear();
                foreach (DataRows row in rows1)
                {
                    PDAFields.Items.Add(row.FieldByName("fieldname"));
                }

                /// запросы
                ///
                SQL = "select text from QrySelect where idQrySelect={0}";
                query.Select(String.Format(SQL, rows[0].FieldByName("idQrySelectBM")));
                rows1 = query.GetRows();
                SelectText.Text = rows1[0].FieldByName("text");

                SQL = "select text from QrySelect where idQrySelect={0}";
                query.Select(String.Format(SQL, rows[0].FieldByName("idQrySelectPDA")));
                rows1 = query.GetRows();
                SelectPDAText.Text = rows1[0].FieldByName("text");

                SQL = "select text from QryDelete where idQryDelete={0}";
                query.Select(String.Format(SQL, rows[0].FieldByName("idQryDelete")));
                rows1 = query.GetRows();
                DeleteText.Text = rows1[0].FieldByName("text");

                SQL = "select text from QryClear where idQryClear={0}";
                query.Select(String.Format(SQL, rows[0].FieldByName("idQryClear")));
                rows1 = query.GetRows();
                ClearText.Text = rows1[0].FieldByName("text");

                SQL = "select text from QryInsert where idQryInsert={0}";
                query.Select(String.Format(SQL, rows[0].FieldByName("idQryInsert")));
                rows1 = query.GetRows();
                InsertText.Text = rows1[0].FieldByName("text");

            }
            else
            {
                checkBox2.Checked = false;
                checkBox1.Checked = false;
                PDAFields.Items.Clear();
                textBox1.Text = "";
            }

            SQL = "select Column_Name from user_tab_columns where Table_Name='{0}'";
            QuerySelectOracle OraQuery=new QuerySelectOracle();
            OraQuery.Select(String.Format(SQL, PDATables.SelectedItem));
            rows = OraQuery.GetRows();
            OraFields.Items.Clear();
            foreach (DataRows row in rows)
            {
                if (!PDAFields.Items.Contains(row.FieldByName("Column_Name")))
                OraFields.Items.Add(row.FieldByName("Column_Name"));
            }
        }
Beispiel #5
0
 private void OraTables_SelectedIndexChanged(object sender, EventArgs e)
 {
     string SQL = "select Column_Name from user_tab_columns where Table_Name='{0}'";
     QuerySelectOracle OraQuery = new QuerySelectOracle();
     OraQuery.Select(String.Format(SQL, OraTables.SelectedItem));
     List<DataRows> rows = OraQuery.GetRows();
     FieldList.Items.Clear();
     foreach (DataRows row in rows)
     {
         FieldList.Items.Add(row.FieldByName("Column_Name"));
     }
 }