private void button15_Click(object sender, EventArgs e) { int magv; string malop; magv = int.Parse(txtgv.Text.Trim()); malop = txtlh.Text.Trim(); GV_LH sh = new GV_LH(magv, malop); try { int i = new GV_LHBUS().SuaGV_LH(sh); if (i == -2) { throw new Exception(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } dgvGV_LH.DataSource = GetGV_LH(); }
public List<GV_LH> GetGV_LH(string sql) { try { SqlDataReader dr = dp.ExecReader(sql); List<GV_LH> list = new List<GV_LH>(); int magv; string lophoc; while (dr.Read()) { magv = dr.GetInt32(0); lophoc = dr.GetString(1); GV_LH gvlh = new GV_LH(magv,lophoc); list.Add(gvlh); } return list; } catch (Exception ex) { throw ex; } finally { dp.disCon(); } }
public int SuaGV_LH(GV_LH LH) { try { return(new GV_LHDAO().SuaGV_LH(LH)); } catch (Exception ex) { throw ex; } }
public int SuaGV_LH(GV_LH GH) { List<SqlParameter> list = new List<SqlParameter>(); list.Add(new SqlParameter("@magv", GH.MaGV)); list.Add(new SqlParameter("@malop", GH.MaLop)); try { return (dp.ExcuteNonquery("SuaGV_LH", System.Data.CommandType.StoredProcedure, list)); } catch (Exception ex) { throw ex; } }