public void Insert(SachTacGia info) { cnn = helper.GetConnect(); sqlString = "Insert into SachTacGia(id, MaSach, MaTacGia) values ('" + info.Id + "',N'" + info.MaSach + "','" + info.MaTacGia + "')"; 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 void Update(SachTacGia info) { stgD.Update(info); }
public void Update(SachTacGia info) { sqlString = "UPDATE SACHTACGIA SET MaTacGia='" + info.MaTacGia + "',MaSach='"+info.MaSach+ "' 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(); }
public void Insert(SachTacGia info) { stgD.Insert(info); }