private void taoTK(TAIKHOAN _tk) { using (var db1 = new TroGiupViecLamEntities()) { db1.TAIKHOANs.Add(_tk); db1.SaveChanges(); } }
private void btnDangKi_Click(object sender, EventArgs e) { bool a = false; using (var db1 = new TroGiupViecLamEntities()) { if (ktTrung(txtTenTK.Text) == true) { TAIKHOAN tk = new TAIKHOAN(); tk.tenTK = txtTenTK.Text; tk.passTK = txtMatKhau.Text; taoTK(tk); MessageBox.Show("Đăng kí thành công."); txtTenTK.Clear(); txtMatKhau.Clear(); } } }