void ganDL(NVBDT dt) { dt.Manxb = txtMaNXB.Text.Trim(); dt.Tennxb = txtTenNXB.Text.Trim(); dt.Diachi = txtDiaChi.Text.Trim(); dt.Web = txtWeb.Text.Trim(); }
//SỬA dl public bool UpdateData(NVBDT dt) { cmd.CommandText = "UPDATE loaisach SET TenNXB= N'" + dt.Tennxb + "', DiaChiNXB= N'" + dt.Diachi + "', Website= N'" + dt.Web + "' WHERE MaNXB ='" + dt.Manxb + "'"; cmd.CommandType = CommandType.Text; cmd.Connection = conn.Connection; try { conn.OpenConn(); cmd.ExecuteNonQuery(); conn.CloseConn(); return(true); } catch (Exception ex) { string mex = ex.Message; cmd.Dispose(); conn.CloseConn(); } return(false); }
//thêm mới dl public bool AddData(NVBDT dt) { cmd.CommandText = "INSERT INTO NXB VALUES ( '" + dt.Manxb + "',N'" + dt.Tennxb + "', N'" + dt.Diachi + "', N'" + dt.Web + "' )"; cmd.CommandType = CommandType.Text; cmd.Connection = conn.Connection; try { conn.OpenConn(); cmd.ExecuteNonQuery(); conn.CloseConn(); return(true); } catch (Exception ex) { string mex = ex.Message; cmd.Dispose(); conn.CloseConn(); } return(false); }
public bool UpdateData(NVBDT dt) { return(MH.UpdateData(dt)); }
public bool AddData(NVBDT dt) { return(MH.AddData(dt)); }