public Vehiculo() { tipoVehiculo = new TipoVehiculo(); modelo = new Modelo(); }
public static List<TipoVehiculo> comBoxTipoVehiculo() { List<TipoVehiculo> lista = new List<TipoVehiculo>(); string connectionString = ConfigurationManager.ConnectionStrings["ParkeoConnString"].ConnectionString; using (SqlConnection connection = new SqlConnection(connectionString)) { SqlCommand command = new SqlCommand("PBD_cmboxTipoVehiculo", connection); command.CommandType = CommandType.StoredProcedure; try { connection.Open(); SqlDataReader reader = command.ExecuteReader(); while (reader.HasRows) { while (reader.Read()) { TipoVehiculo tipo = new TipoVehiculo(); tipo.IdTipoVehiculo = reader.GetInt32(0); tipo.Nombre = reader.GetString(1); lista.Add(tipo); } reader.NextResult(); } reader.Close(); } catch (SqlException ex) { throw ex; } catch (Exception ex) { throw ex; } } return lista; }