When using the SADataAdapter, 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.
Declare and initialize an SAConnection object.
SAConnection conn = new SAConnection( c_connStr ); |
Open the connection.
conn.Open(); |
Create an SADataAdapter with the SELECT statement you want to use. The schema is returned for the result set of this query.
SADataAdapter adapter = new SADataAdapter( "SELECT * FROM Employees", conn ); |
Create a new DataTable object, in this case called Table, to fill with the schema.
DataTable dataTable = new DataTable( "Table" ); |
Fill the DataTable with the schema from the data source.
adapter.FillSchema( dataTable, SchemaType.Source ); |
Close the SAConnection object.
conn.Close(); |
Bind the DataSet to the grid on the screen.
dataGrid.DataSource = dataTable; |
Discuss this page in DocCommentXchange.
|
Copyright © 2010, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.0 |