示例#1
0
        private void button1_Click(object sender, EventArgs e)
        {
            //-----Oracle ------
            //con3 = new OracleConnection("Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=XE)));User Id =system; Password =system");
            //con3.Open();

            //string sql = "delete from extract";
            //OracleCommand cmd = new OracleCommand(sql, con3);
            //OracleDataReader r = cmd.ExecuteReader();
            //con3.Close();

            //------ MySQL ------

            try
            {
                MySqlConnection MyConn1     = new MySqlConnection("datasource=localhost;port=3306;username=root;password=aerospace");
                string          DeleteQuery = "delete from sys.sys_mon";
                MySqlCommand    MyCommand1  = new MySqlCommand(DeleteQuery, MyConn1);
                MyConn1.Open();
                int n = MyCommand1.ExecuteNonQuery();
                if (n >= 0)
                {
                    Console.WriteLine("Data Deleted from table sys_mon. No of rows deleted = " + n);
                }
                MyConn1.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            monitor frm = new monitor();

            frm.ParentFormObject = this; // pass the parent form object
            frm.Show();
            //this.Hide();
        }