public void Update(DS_Flight.AirportCodeDataTable airportTable) { if (airportTable != null && airportTable.Rows.Count > 0) { for (int i = 0; i < airportTable.Rows.Count; i++) { DS_Flight.AirportCodeRow row = airportTable.Rows[i] as DS_Flight.AirportCodeRow; if (row.RowState == DataRowState.Added) { AddAirportCode(row.airportCode, row.name, row.name_cn, row.country); } else if (row.RowState == DataRowState.Modified) UpdateAirportCode(row.airportID, row.airportCode, row.name, row.name_cn, row.country); } } }
public DS_Flight.AirportCodeDataTable SearchAirport(string airport) { DS_Flight ds = new DS_Flight(); StringBuilder sb = new StringBuilder(); sb.Append("SELECT airportID, airportCode, [name], name_cn, country FROM AirportCode"); if (airport != null && airport.Trim().Length > 0) { string s = SqlCleanString(airport); sb.Append(" WHERE [name] like '"); sb.Append(s); sb.Append("' or name_cn like '"); sb.Append(s); sb.Append("' or airportCode='"); sb.Append(airport.Trim()); sb.Append("'"); } sb.Append(" order by airportCode"); m_dao.FillDataSet(ds, "AirportCode", sb.ToString(), null); return ds.AirportCode; }