//thêm mới dl public bool AddData(ChucVuDT dtCV) { cmd.CommandText = "INSERT INTO chucvu values ('" + dtCV.Machucvu + "',N'" + dtCV.Tenchucvu + "')"; 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); }
//SỬA dl public bool UpdateData(ChucVuDT dtCV) { cmd.CommandText = "UPDATE chucvu SET tenchucvu= N'" + dtCV.Tenchucvu + "' WHERE machucvu ='" + dtCV.Machucvu + "'"; 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(ChucVuDT dtCV) { return(cvMH.UpdateData(dtCV)); }
public bool AddData(ChucVuDT dtCV) { return(cvMH.AddData(dtCV)); }
//ham lay du lieu tu cotroller void ganDL(ChucVuDT dtCV) { dtCV.Machucvu = txtMaChucVu.Text.Trim(); dtCV.Tenchucvu = txtTenChucVu.Text.Trim(); }