public void Update(TaiKhoan info) { string sqlQuery = "update TaiKhoan" + " set MatKhau='" + info.MatKhau + "'" + "where TenDangNhap='" + info.TenDangNhap + "'"; ExecuteNonQuery(sqlQuery); }
public void Insert(TaiKhoan info) { string sqlQuery = "insert into TaiKhoan values ('" + info.TenDangNhap + "','" + info.MatKhau + "')"; ExecuteNonQuery(sqlQuery); }
public List<TaiKhoan> GetList() { List<TaiKhoan> list = new List<TaiKhoan>(); string sqlQuery = "select * from TaiKhoan"; reader = ExecuteReader(sqlQuery); while (reader.Read()) { TaiKhoan tacGia = new TaiKhoan(); tacGia.MatKhau = reader["MatKhau"].ToString(); tacGia.TenDangNhap = reader["TenDangNhap"].ToString(); list.Add(tacGia); } return list; }
private void btThem_Click(object sender, RoutedEventArgs e) { TaiKhoan taiKhoan = new TaiKhoan() { TenDangNhap = tbTaiKhoan.Text, MatKhau = tbMatKhau.Text }; TaiKhoanBUS bus = new TaiKhoanBUS(); try { bus.Insert(taiKhoan); MessageBox.Show("Thêm thành công !"); } catch (Exception) { MessageBox.Show("Thêm thất bại !"); } LoadData(); }
public void Update(TaiKhoan info) { data.Update(info); }
public void Insert(TaiKhoan info) { data.Insert(info); }