コード例 #1
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            string delete = "delete from tblNhanVien where MaNV=N'" + txtMaNV.Text + "'";

            if (MessageBox.Show("Bạn có muốn xóa không", "Xóa dữ liệu", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                mydt.runQuery(delete);
            }
            gridViewHSNV.Refresh();
            mydt.loaddata(gridViewHSNV, "select * from tblNhanVien");
        }
コード例 #2
0
        private void btnXoa_Click(object sender, EventArgs e)
        {
            string delete = "delete from tblChiTietChamCong where NgayCong ='" + dateCong.Text + "'";

            if (MessageBox.Show("Bạn có muốn xóa không", "Xóa dữ liệu", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                mydt.runQuery(delete);
            }
            loaddt();
        }
コード例 #3
0
        private void btnHoanTat_Click(object sender, EventArgs e)
        {
            int a = 0, b = 0;

            dr = DemMa(txtMaNV.Text);
            while (dr.Read())
            {
                a += dr.GetInt32(0);
            }
            dr = DemTen(txtĐN.Text);
            while (dr.Read())
            {
                b = dr.GetInt32(0);
            }

            String query = "insert into tblTaiKhoan( MaNV, TenNhanVien, TenTaiKhoan, MatKhau) values('" + txtMaNV.Text + "',N'" + txtTenNV.Text + "',N'" + txtĐN.Text + "','" + txtMK.Text + "')";

            if (a > 0)
            {
                MessageBox.Show("Nhân viên đã có tài khoản đăng nhập");
                txtMaNV.Clear();
            }
            else
            {
                if (b > 0)
                {
                    MessageBox.Show("Tên đăng nhập này đã tồn tại");
                    txtĐN.Clear();
                }
                else
                {
                    mydt.runQuery(query);
                    MessageBox.Show("Chúc mừng bạn đã đăng kí thành công");
                    this.Close();
                }
            }
        }
コード例 #4
0
        private void btnCapNhat_Click(object sender, EventArgs e)
        {
            string query = string.Format("update tblLuong set LuongCoBan = '" + txtLuongCB.Text + "' where HeSoLuong = '" + comboHSL.Text + "'");

            mydt.runQuery(query);
        }