public void Insert(Sach info) { cnn = helper.GetConnect(); sqlString = "Insert into Sach(id, Ten, GiaMua, GiaBan, MaNhaCungCap, SoLuong, MaTheLoai, MaNhaXuatBan ) " + "values ('" + info.Id + "',N'" + info.TenSach + "','" + info.GiaMua + "','" + info.GiaBan + "','" + info.NhaCungCap + "','" + info.SoLuong + "','" + info.TheLoai + "','" + info.NhaXuatBan + "')"; try { //Thực thi câu lệnh SQL cmd = new SqlCommand(sqlString, cnn); cmd.ExecuteNonQuery(); } catch (System.Exception e) { cnn.Close(); throw new Exception("Lỗi Kết Nối Cơ sở dữ liệu."); } cnn.Close(); }
public PhieuMuon() { docGia = new DocGia(); nhanVien = new NhanVien(); sach = new Sach(); }
public CT_PhieuMuon() { sach = new Sach(); phieuMuon = new PhieuMuon(); }
public void Update(Sach info) { sD.Update(info); }
public void Insert(Sach info) { sD.Insert(info); }
public void Update(Sach info) { sqlString = "UPDATE SACH SET Ten=N'" + info.TenSach + "',GiaMua='" + info.GiaMua + "',GiaBan='" + info.GiaBan + "',MaNhaCungCap='" + info.NhaCungCap + "',SoLuong='" + info.SoLuong + "',MaTheLoai='" + info.TheLoai + "',MaNhaXuatBan='" + info.NhaXuatBan + "' WHERE id='" + info.Id + "'"; cnn = helper.GetConnect(); try { //Thực thi câu lệnh SQL cmd = new SqlCommand(sqlString, cnn); cmd.ExecuteNonQuery(); } catch (System.Exception e) { cnn.Close(); throw new Exception("Lỗi Kết Nối Cơ sở dữ liệu."); } cnn.Close(); }