SQLRetrieveColumns

Syntax

SQLRetrieveColumns(ConnectNum)

Remarks

Determines the number of columns available in the data source. To use SQLRetrieveColumns, a macro must have already established a connection using SQLOpen. Also, a query must already have been executed using SQLExecQuery or SQLQueryExec, and results must be pending.

Argument

Explanation

ConnectNum

The unique connection ID for a data source. If ConnectNum is not valid, SQLExecQuery or SQLQueryExec would have returned an error value. In such a case, SQLRetrieveColumns places error information in memory for the error functions, if such information is available.


SQLRetrieveColumns returns the number of columns in the data source. Note that the column count is one-based; that is, the first column is 1, not 0 (zero).

If there are no results pending on the connection, no data was found, or there is no data, SQLRetrieveColumns returns –1 (SQL_NoMoreData).