Previous Topic

Next Topic

Populate the Airport DataSet

Populate the DataSet with the ingresDataAdapter3.Fill(DataSet dataSet) method.

public void LoadAirport(int direction, String area, System.Data.DataTable airportTable)

{

    DataRow dataRow;

 

    IngresParameter country = new Ingres.Client.IngresParameter(

        "ap_ccode", IngresType.NChar);

    IngresParameter region = new Ingres.Client.IngresParameter(

        "ap_place", IngresType.NVarChar);

    region.Value = area;

    airportTable.Clear();

    dataRow = airportTable.NewRow();

    dataRow["ap_iatacode"] = "";

    airportTable.Rows.InsertAt(dataRow, 0);

    ingresDataAdapter3.SelectCommand.Connection.Open();

    ingresDataAdapter3.SelectCommand.Prepare();

    ingresDataAdapter3.SelectCommand.Parameters.Clear();

    switch (direction)

    {

        case DEPART:

            country.Value = departing.country;

            departing.region = region.Value.ToString();

            break;

        case ARRIVE:

            country.Value = arriving.country;

            arriving.region = region.Value.ToString();

            break;

    }

    ingresDataAdapter3.SelectCommand.Parameters.Add(country);

    ingresDataAdapter3.SelectCommand.Parameters.Add(region);

    ingresDataAdapter3.Fill(airportTable);

    ingresDataAdapter3.SelectCommand.Connection.Close();

}

Note: Use an instance of the table defined in the AirportDataSet as a parameter to this method. For example:

AirportDataSet airportDataSet = new AirportDataSet();

LoadAirport(direction, comboBox1.SelectedValue.ToString(),

    airportDataSet.Tables["airport"]);


© 2006 Ingres Corporation. All rights reserved.