public void AddMaintain(maintain m) { maintains.Add(m); DatabaseUtil dbu = new DatabaseUtil(); string sql = "insert into t_maintainForm values " + m.getTime() + "," + m.getName() + "," + m.getAddress() + "," + m.getType() + "," + m.getText() + "," + m.getState() + "," + m.getWorker() + "," + m.getFeederivate() + "," + m.getFee() + ")"; dbu.Open(); dbu.Excute(sql); dbu.Close(); }
public void RemoveMaintain(maintain m) { maintains.Remove(m); DatabaseUtil dbu = new DatabaseUtil(); string sql = "delete from t_maintainForm where id=" + m.getMID(); dbu.Open(); dbu.Excute(sql); dbu.Close(); }
public Maintains() { maintains = new List <maintain>(); DatabaseUtil dbu = new DatabaseUtil(); string sql = "select * from t_maintainForm"; dbu.Open(); SqlDataReader dr = dbu.Query(sql); while (dr.Read()) { maintain mt = new maintain(dr[1].ToString(), dr[2].ToString(), dr[3].ToString(), dr[4].ToString(), dr[5].ToString(), dr[6].ToString(), dr[7].ToString(), dr[8].ToString(), dr[9].ToString()); maintains.Add(mt); } dbu.Close(); }