public void Load_cboxNXB() { string dt = "select * from NXB"; cboxNXB.DisplayMember = "TenNXB"; cboxNXB.DataSource = DatabaseService.getDataTable(dt); }
private void btnThem_Click(object sender, EventArgs e) { string them = @"insert into SACH values (N'" + cboxTheLoai.Text + "',N'" + txtTenSach.Text + "',N'" + cboxTacGia.Text + "',N'" + cboxNXB.Text + "','" + dateNgayNhap.Text + "','" + txtSLTon.Text + "','" + txtSLMuon.Text + "')"; DatabaseService.executeQuery(them); Load_Data(); }
// Load Tác Giả public void Load_cboxTacGia() { string dt = "select * from TACGIA"; cboxTacGia.DisplayMember = "TenTG"; cboxTacGia.DataSource = DatabaseService.getDataTable(dt); }
public void Load_cboxTheLoai() { string dt = "select * from THELOAI"; cboxTheLoai.DisplayMember = "TenTL"; cboxTheLoai.DataSource = DatabaseService.getDataTable(dt); }
public void Load_Data() { string str = @"select * from SACH"; DataTable dt = DatabaseService.getDataTable(str); dataSach.DataSource = dt; }
private void btnCapNhat_Click(object sender, EventArgs e) { string CapNhatTS = @"update SACH set TheLoai=N'" + cboxTheLoai.Text + "',TenSach=N'" + txtTenSach.Text + "',TacGia=N'" + cboxTacGia.Text + "',NXB=N'" + cboxNXB.Text + "',NgayNhap=N'" + dateNgayNhap.Text + "',SLTon='" + txtSLTon.Text + "',SLMuon='" + txtSLMuon.Text + "' where MaSach='" + txtMaSach.Text + "'"; DatabaseService.executeQuery(CapNhatTS); Load_Data(); }
private void txtTim_TextChanged(object sender, EventArgs e) { string TimKiemTS = @"select * from SACH where TenSach LIKE N'%" + txtTim.Text + "%' or TacGia LIKE N'%" + txtTim.Text + "%' or TheLoai LIKE N'%" + txtTim.Text + "%'"; DataTable dt = DatabaseService.getDataTable(TimKiemTS); dataSach.DataSource = dt; }