public List <linea> getLineas() { List <linea> lineas = new List <linea>(); String Qry = @"SELECT * from linea"; BaseDatos d = new BaseDatos(); d.Conectar(); d.CrearComando(Qry); DbDataReader datosItems = d.EjecutarConsulta(); while (datosItems.Read()) { linea l = new linea(); l.Id = Convert.ToInt32(datosItems["id"].ToString()); l.Linea = datosItems["linea"].ToString() + " - " + datosItems["descripcion"].ToString(); lineas.Add(l); } datosItems.Close(); d.Desconectar(); return(lineas); }
public List <linea> getLineas(string id) { List <linea> lineas = new List <linea>(); String Qry = @"SELECT * from linea where id=@id"; BaseDatos d = new BaseDatos(); d.Conectar(); d.CrearComando(Qry); d.AsignarParametroCadena("@id", id); DbDataReader datosItems = d.EjecutarConsulta(); while (datosItems.Read()) { linea l = new linea(); l.Id = Convert.ToInt32(datosItems["id"].ToString()); l.Linea = datosItems["linea"].ToString(); lineas.Add(l); } datosItems.Close(); d.Desconectar(); return(lineas); }