Obtaining AseDataAdapter schema information

When using the AseDataAdapter, 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, see “FillSchema method”.

StepsObtaining DataSet schema information using the FillSchema method

  1. Declare and initialize an AseConnection object:

    For C#:

    AseConnection   conn = new AseConnection(     
       c_connStr );
    

    For Visual Basic .NET:

    Dim conn As New AseConnection( _
       c_connStr )
    
  2. Open the connection:

    For C#:

    conn.Open();
    

    For Visual Basic .NET:

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

    For C#:

    AseDataAdapter  adapter = new AseDataAdapter(     
       "SELECT * FROM employee", conn );
    

    For Visual Basic .NET:

    Dim adapter As New AseDataAdapter( _
       "SELECT * FROM employee", conn )
    
  4. Create a new DataTable object, in this case called “Table,” to fill with the schema:

    For C#:

    DataTable dataTable = new DataTable( "Table" );
    

    For Visual Basic .NET:

    Dim dataTable As New DataTable( "Table" )
    
  5. Fill the DataTable with the schema from the data source:

    For C#:

    adapter.FillSchema( dataTable, SchemaType.Source );
    

    For Visual Basic .NET:

    adapter.FillSchema( dataTable, SchemaType.Source )
    
  6. Close the AseConnection object:

    For C#:

    conn.Close();
    

    For Visual Basic .NET:

    conn.Close()
    
  7. Bind the DataSet to the grid on the window:

    For C#:

    dataGrid.DataSource = dataTable;
    

    For Visual Basic .NET:

    dataGrid.DataSource = dataTable