Contents Index Inserting, updating, and deleting rows using the AsaCommand object Using the AsaDataAdapter object to access and manipulate data

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

Obtaining DataReader schema information

You can obtain schema information about columns in the result set.

If you are using the AsaDataReader, you can use the GetSchemaTable method to obtain information about the result set. The GetSchemaTable method returns the standard .NET DataTable object, which provides information about all the columns in the result set, including column properties.

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

To obtain information about a result set using the GetSchemaTable method

  1. Declare and initialize a connection object.

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

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

    AsaCommand cmd = new AsaCommand(
        "SELECT * FROM employee", conn );
  4. Create an AsaDataReader object and execute the Command object you created.

    AsaDataReader   dr = cmd.ExecuteReader();
  5. Fill the DataTable with the schema from the data source.

    DataTable       schema = dr.GetSchemaTable();
  6. Close the AsaDataReader and AsaConnection objects.

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

    dataGrid.DataSource = schema;

Contents Index Inserting, updating, and deleting rows using the AsaCommand object Using the AsaDataAdapter object to access and manipulate data