Exemple #1
0
        private void LoadData()
        {
            string    sql     = "select * from tb_lop";
            DataTable mytable = KN.E_SQL(sql);

            dgv1.DataSource = mytable;
        }
Exemple #2
0
        private void bt_them_Click(object sender, EventArgs e)
        {
            string sql = "insert into tb_sinhvien(msv , tensv , ngaysinh ,gioitinh, dienthoai ,diachi , malop) values('" + tb_msv.Text + "','" + tb_tensv.Text + "','" + dTP_ns.Text + "','" + ParseBool2string(rd1.Checked) + "','" + tb_dt.Text + "','" + tb_dc.Text + "','" + cb_lop.Text + "')";

            KN.Nonquery(sql);
            LoadData();
        }
Exemple #3
0
        private void bt_xoa_Click(object sender, EventArgs e)
        {
            string sql = "delete from tb_sinhvien where msv='" + tb_msv.Text + "'";

            KN.ExecuteNonquery_Pro(sql);
            LoadData();
        }
Exemple #4
0
        private void bt_sua_Click(object sender, EventArgs e)
        {
            string sql = " update tb_sinhvien set msv='" + tb_msv.Text + "', tensv=N'" + tb_tensv.Text + "',ngaysinh='" + dTP_ns.Text + "',gioitinh='" + ParseBool2string(rd1.Checked) + "',dienthoai='" + tb_dt.Text + "',diachi=N'" + tb_dc.Text + "',malop='" + cb_lop.Text + "'where msv='" + tb_msv.Text + "'";

            KN.ExecuteNonquery_Pro(sql);
            LoadData();
        }
Exemple #5
0
        private void tb_timkiem_TextChanged(object sender, EventArgs e)
        {
            string value = tb_timkiem.Text;

            if (!string.IsNullOrEmpty(value))
            {
                string    sql     = "select * from tb_sinhvien where msv='" + tb_timkiem.Text + "'";
                DataTable mytable = KN.E_SQL(sql);
                dgv.DataSource = mytable;
            }
            else
            {
                LoadData();
            }
        }