Contents Index Inserting, updating, and deleting rows using the AsaDataAdapter object Obtaining primary key values

ASA Programming Guide
  Developing Applications with the .NET Data Provider
    Accessing and manipulating data
      Using the AsaDataAdapter object to access and manipulate data

Obtaining AsaDataAdapter schema information

When using the AsaDataAdapter, you can use the FillSchema method to obtain schema information about the result set in the DataSet. The FillSchema method returns the standard .NET DataTable object, which provides the names of all the columns in the result set.

For more information about the FillSchema method, see FillSchema method.

To obtain DataSet schema information using the FillSchema method

  1. Declare and initialize an AsaConnection object.

    AsaConnection   conn = new AsaConnection(
        c_connStr );
  2. Open the connection.

    conn.Open();
  3. Create an AsaDataAdapter with the SELECT statement you want to use. The schema is returned for the result set of this query.

    AsaDataAdapter  adapter = new AsaDataAdapter(
        "SELECT * FROM employee", conn );
  4. Create a new DataTable object, in this case called Table, to fill with the schema.

    DataTable       dataTable = new DataTable(
        "Table" );
  5. Fill the DataTable with the schema from the data source.

    adapter.FillSchema( dataTable, SchemaType.Source );
  6. Close the AsaConnection object.

    conn.Close();
  7. Bind the DataSet to the grid on the screen.

    dataGrid.DataSource = dataTable;

Contents Index Inserting, updating, and deleting rows using the AsaDataAdapter object Obtaining primary key values