示例#1
0
        private void button4_Click(object sender, EventArgs e)
        {
            RequestFailed frm = new RequestFailed();
            frm.MdiParent = this.ParentForm;
            this.Close();
            frm.Show();

        }
示例#2
0
        private void button3_Click(object sender, EventArgs e)
        {
            string query = string.Empty;


            string strDbPath = Application.StartupPath + @"\CodeChildren1Offical.mdb";
            string strCnn = "Provider = Microsoft.Jet.OleDb.4.0; Data Source = " + strDbPath;
            OleDbConnection conn = new OleDbConnection(strCnn);
            try
            {
                conn.Open();
                openFileDialog1.ShowDialog();
                query = "INSERT INTO BlockProgram(LinkProgram, Status) VALUES('" + System.IO.Path.GetFileName(openFileDialog1.FileName.Substring(openFileDialog1.FileName.LastIndexOf(@"\") + 1)) + "','bat')";
                if (System.IO.Path.GetFileName(openFileDialog1.FileName.Substring(openFileDialog1.FileName.LastIndexOf(@"\") + 1)) == "openFileDialog1")
                {
                    MessageBox.Show("Bạn đã không nhập gì cả ");
                    RequestFailed frm = new RequestFailed();
                    frm.MdiParent = this.ParentForm;
                    this.Close();
                    frm.Show();

                }

                else
                {
                    OleDbCommand sqlCommand = new OleDbCommand(query, conn);
                    sqlCommand.ExecuteNonQuery();
                    listView1.Items.Add(System.IO.Path.GetFileName(openFileDialog1.FileName.Substring(openFileDialog1.FileName.LastIndexOf(@"\") + 1)));
                    MessageBox.Show("Đã Nhập Vào Chương Trình Cần Chặn !!!");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.StackTrace);
            }
            finally
            {
                conn.Close();
                conn.Dispose();
            }
        }