public void Insert(TheLoai info) { cnn = helper.GetConnect(); sqlString = "Insert into THELOAI(id, Ten) values ('" + info.Id + "',N'" + info.Ten +"')"; 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 int isValid() { if (TenSach.Equals("")) { return(1); } if (TacGia.Equals("")) { return(2); } if (SoLuong <= 0) { return(3); } if (TheLoai.Equals("")) { return(4); } if (TomTat.Equals("")) { return(5); } return(0); }
public void Update(TheLoai info) { tlD.Update(info); }
public void Insert(TheLoai info) { tlD.Insert(info); }
public Sach() { nxb = new NXB(); tacGia = new TacGia(); theLoai = new TheLoai(); }
public void Update(TheLoai info) { sqlString = "UPDATE THELOAI SET Ten=N'" + info.Ten + "' 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(); }