You can obtain schema information about columns in the result set.
If you are using the SADataReader, 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.
Declare and initialize a connection object.
SAConnection conn = new SAConnection( c_connStr );
Open the connection.
Create an SACommand object with the SELECT statement you want to use. The schema is returned for the result set of this query.
SACommand cmd = new SACommand( "SELECT * FROM Employees", conn );
Create an SADataReader object and execute the Command object you created.
SADataReader dr = cmd.ExecuteReader();
Fill the DataTable with the schema from the data source.
DataTable schema = dr.GetSchemaTable();
Close the SADataReader and SAConnection objects.
Bind the DataTable to the grid on the screen.
dataGrid.DataSource = schema;