Returns the name of a result column.
SqlColName$ ( sqlconn%, column% )
where
A string containing the name of a result column. If the column number is out of range or if the column is the result of an expression with no name assigned, an empty string is returned.
The following code fragment uses SqlColName$ to return the name, id, and type column names from the sysobjects table:
'Put the statement into the command buffer. cmd$ = "SELECT name, id, type FROM sysobjects" Result% = SqlCmd%(Sqlconn%, cmd$) 'Send the statement to SQL Server and start execution. Result% = SqlExec%(Sqlconn%) 'Process the statement results. Result% = SqlResults%(Sqlconn%) 'Print the column names. FOR ColumnNum% = 1 TO 3 ColumnName$ = SqlColName$(Sqlconn%, ColumnNum%) PRINT "Column"; ColumnNum%; " name is "; ColumnName$ NEXT ColumnNum%
Output:
Column 1 name is name Column 2 name is id Column 3 name is type
SqlColLen%, SqlColType%, SqlData$, SqlDatLen&, SqlNumCols%