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”.
Obtaining DataSet schema information using the FillSchema method
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 )
Open the connection:
For C#:
conn.Open();
For Visual Basic .NET:
conn.Open()
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 )
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" )
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 )
Close the AseConnection object:
For C#:
conn.Close();
For Visual Basic .NET:
conn.Close()
Bind the DataSet to the grid on the window:
For C#:
dataGrid.DataSource = dataTable;
For Visual Basic .NET:
dataGrid.DataSource = dataTable