Esempio n. 1
0
        public string[] ValidationList()
        {
            string sql = "select validation ||'  ' ||cmmnt as item from hdb_validation " // where validation in ('A','F','L','H','P','T','V') "
                         + "UNION  SELECT '    <<null>>' from dual ";
            DataTable tbl = m_server.Table("validation", sql);

            return(DataTableUtility.StringList(tbl, "", "item").ToArray());
        }
Esempio n. 2
0
 /// <summary>
 /// Execute SQL Statement
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void buttonSql_Click(object sender, System.EventArgs e)
 {
     if (this.richTextBoxSql.Text.Length > 0)
     {
         Cursor = Cursors.WaitCursor;
         try
         {
             //oracle.SetDateFormat();
             DataTable tbl;
             string    sql = this.richTextBoxSql.Text;
             if (sql.ToLower().IndexOf("update") >= 0 || sql.ToLower().IndexOf("insert") >= 0 ||
                 sql.ToLower().IndexOf("drop") >= 0 || sql.ToLower().IndexOf("create") >= 0 ||
                 sql.ToLower().IndexOf("alter") >= 0 || sql.ToLower().IndexOf("truncate") >= 0 ||
                 sql.ToLower().IndexOf("rename") >= 0 || sql.ToLower().IndexOf("delete") >= 0 ||
                 sql.ToLower().IndexOf("merge") >= 0 || sql.ToLower().IndexOf("grant") >= 0 ||
                 sql.ToLower().IndexOf("revoke") >= 0 || sql.ToLower().IndexOf("analyze") >= 0 ||
                 sql.ToLower().IndexOf("audit") >= 0 || sql.ToLower().IndexOf("comment") >= 0 ||
                 sql.ToLower().IndexOf("commit") >= 0 || sql.ToLower().IndexOf("rollback") >= 0 ||
                 sql.ToLower().IndexOf("savepoint") >= 0 || sql.ToLower().IndexOf("set") >= 0)
             {
                 tbl = new DataTable("queryerror");
                 tbl.Columns.Add("ERROR");
                 tbl.Rows.Add("You");
                 tbl.Rows.Add("may");
                 tbl.Rows.Add("only");
                 tbl.Rows.Add("execute");
                 tbl.Rows.Add("SELECT");
                 tbl.Rows.Add("statements");
                 tbl.Rows.Add("using");
                 tbl.Rows.Add("this");
                 tbl.Rows.Add("interface");
             }
             else if (sql.ToLower().IndexOf("$") >= 0)
             {
                 MessageBox.Show("Missing input found. Replace all $-variables with your desired inputs.", "Missing Input", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 tbl = new DataTable("queryerror");
             }
             else
             {
                 tbl = oracle.Table("queryreturn", this.richTextBoxSql.Text);
             }
             this.dataGrid1.DataSource = tbl;
         }
         catch (Exception ex)
         {
             string msg = "Error: " + ex.Message;
             MessageBox.Show(msg, "HDB Poet", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         finally
         {
             Cursor = Cursors.Default;
         }
     }
 }
Esempio n. 3
0
        private void buttonSql_Click(object sender, System.EventArgs e)
        {
            if (this.textBoxSql.Text.Length > 0)
            {
                Cursor = Cursors.WaitCursor;
                try
                {
                    //oracle.SetDateFormat();
                    DataTable tbl;
                    string    sql = this.textBoxSql.Text;
                    if (sql.ToLower().IndexOf("update") >= 0 ||
                        sql.ToLower().IndexOf("insert") >= 0 ||
                        sql.ToLower().IndexOf("alter") >= 0
                        )
                    {
                        oracle.RunSqlCommand(sql);
                        tbl = new DataTable();
                    }
                    else
                    {
                        tbl = oracle.Table("test", this.textBoxSql.Text);
                    }
                    this.dataGrid1.DataSource = tbl;

                    if (tbl.Columns.Contains("tmstp"))
                    {
//				SoiUtility.FormatDataColumn(dataGrid1,"tmstp","Time Stamp",SoiConstants.TimeFormat);
                    }

                    this.labelRecordCount.Text = tbl.Rows.Count.ToString() + " Records";

                    //this.dataGrid1.ReadOnly = true;
                    this.listBoxSql.Items.Add(this.textBoxSql.Text);
                }
                catch (Exception ex)
                {
                    string msg = "Error: " + ex.Message;
                    MessageBox.Show(msg, "HDB Poet",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                finally
                {
                    Cursor = Cursors.Default;
                }
            }
        }