Determines the number of columns for the current result set.
INT dbnumcols ( PDBPROCESS dbproc );
The number of columns in the current result set. If there are no columns, 0 is returned. Call dbnumcols after dbresults has returned SUCCEED.
The following program fragment shows how to use dbnumcols:
int        column_count;
DBPROCESS    *dbproc;
// Put the commands into the command buffer 
dbcmd(dbproc, "SELECT name, id, type FROM sysobjects");
dbcmd(dbproc, " SELECT name FROM sysobjects");
// Send the commands to SQL Server and start execution 
dbsqlexec(dbproc);
// Process each command until there are no more 
while (dbresults(dbproc) != NO_MORE_RESULTS)
{
    column_count = dbnumcols(dbproc);
    printf("%d columns in this SQL Server result.\n", column_count);
    while (dbnextrow(dbproc) != NO_MORE_ROWS)
        printf("row received.\n");
}
  
| dbcollen | dbcolname |