public static string[] GetAirportCodes(string prefixText) { try { DataSet ds = new DataSet(); FlightBAL objFlightBal = new FlightBAL(); ds = objFlightBal.GetAirportCodes(); string filteringquery = "CityName LIKE'" + prefixText + "%'"; //Select always return array,thats why we store it into array of Datarow DataRow[] dr = ds.Tables[0].Select(filteringquery); //create new table DataTable dtNew = new DataTable(); //create a clone of datatable dt and store it into new datatable dtNew = ds.Tables[0].Clone(); //fetching all filtered rows add add into new datatable foreach (DataRow drNew in dr) { dtNew.ImportRow(drNew); } //return dtAirportCodes; List<string> airports = new List<string>(); for (int i = 0; i < dtNew.Rows.Count; i++) { airports.Add(dtNew.Rows[i]["CityName"].ToString().Trim() + "," + dtNew.Rows[i]["AirportDesc"].ToString().Trim() + " - (" + dtNew.Rows[i]["AirportCode"].ToString().Trim() + ")"); } return airports.ToArray(); } catch (Exception) { throw; } }