Determines the number of columns for the current results set.
INT dbnumcols ( PDBPROCESS dbproc );
where
The number of columns in the current results 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"); }