private DatabaseQuery CreateQuery(bool orderResults) { var query = new DatabaseQuery(); // Select a few columns. query.SelectField(Monikers.FlightId); query.SelectField(Monikers.TailNumber); query.SelectField(Monikers.CityPair); query.SelectField(Monikers.TakeoffAirportName); query.SelectField(Monikers.LandingAirportName); // Filter for takeoff and landing valid. query.AddBooleanFilter(Monikers.TakeoffValid, true); query.AddBooleanFilter(Monikers.LandingValid, true); // Order by flight id. if (orderResults) { query.OrderByField(Monikers.FlightId); } // Use display formatting. query.ValueFormat = DbQueryFormat.Display; return(query); }