/// /// <summary> /// Returns all the areas in Chicago, ordered by area # or name. /// </summary> /// <param name="ordering"></param> /// <returns>List of Area objects</returns> /// public List <Area> GetChicagoAreas(OrderAreas ordering) { List <Area> areas = new List <Area>(); Business bus = new Business("C:\\Users\\Jacky\\Downloads\\CrimeDB.mdf"); string sql = @" SELECT * FROM Areas WHERE Area > 0 ORDER BY AreaName ASC; "; // // TODO! // //int counter = 1; DataSet result = dataTier.ExecuteNonScalarQuery(sql); foreach (DataRow row in result.Tables["TABLE"].Rows) { Area a; a = new Area((Convert.ToInt32(row["Area"])), Convert.ToString(row["AreaName"])); areas.Add(a); //counter++; } return(areas); }
/// /// <summary> /// Returns all the areas in Chicago, ordered by area # or name. /// </summary> /// <param name="ordering"></param> /// <returns>List of Area objects</returns> /// public List <Area> GetChicagoAreas(OrderAreas ordering) { List <Area> areas = new List <Area>(); var dat = dataTier.ExecuteNonScalarQuery("SELECT Area, AreaName FROM Areas ORDER BY AreaName ASC;"); foreach (DataRow row in dat.Tables["TABLE"].Rows) { areas.Add(new Area(Convert.ToInt32(row["Area"]), row["AreaName"].ToString())); } return(areas); }