public static Affecter findByNumero(string numero) { Affecter affecter = null; OdbcCommand cmd = new OdbcCommand("select * from affecter where Numero=?", AccesBd.getConnection()); cmd.Parameters.Add("@numero", OdbcType.VarChar).Value = numero; OdbcDataReader dr = cmd.ExecuteReader(); if (dr.Read()) { affecter = new Affecter { Id = dr.GetInt32(0), Numero = dr.GetString(1), DateDebut = dr.GetDateTime(2), DateFin = dr.GetDateTime(3), ligne = LigneDao.findByNumero(dr.GetString(4)), bus = BusDao.findByNumero(dr.GetString(5)) }; } cmd.Dispose(); return(affecter); }
public static Points find(int Id) { Points point = null; OdbcCommand cmd = new OdbcCommand("select * from point where Id=?", AccesBd.getConnection()); cmd.Parameters.Add("@id", OdbcType.Int).Value = Id; OdbcDataReader dr = cmd.ExecuteReader(); if (dr.Read()) { point = new Points { Id = dr.GetInt32(0), Numero = dr.GetString(1), Description = dr.GetString(2), coordonnee = dr.GetString(3), Etat = dr.GetString(4), ligne = LigneDao.findByNumero(dr.GetString(5)) }; } cmd.Dispose(); return(point); }