Returns a pointer to the data for a result column.
LPCBYTE dbdata (
PDBPROCESS dproc,
INT column );
where
A BYTE pointer to the data for the column. A NULL BYTE pointer is returned if there is no such column or if the data has a null value. To make sure that the data is really a null value, check for a return of 0 from dbdatlen.
The data is not null-terminated. To get the length of the data, use dbdatlen.
The dbbind function automatically binds data to your program variables. It is often easier to use than dbdata, but it makes a copy of the data. Call dbdata only after dbnextrow or dbgetrow has returned reg_row.
The following example shows how to use dbdata:
DBPROCESS *dbproc; DBINT row_number = 0; DBINT object_id; // Put the command into the command buffer. dbcmd(dbproc, "select id from sysobjects"); // Send the command to SQL Server and begin execution. dbsqlexec(dbproc); // Process the command results. dbresults(dbproc); // Examine the data in each row. while (dbnextrow(dbproc) != NO_MORE_ROWS) { row_number+; object_id = *((DBINT *)dbdata(dbproc, 1)); printf("row %ld, object id is %ld.\n", row_number, object_id); }
dbbind, dbcollen, dbcolname, dbcoltype, dbdatlen, dbnumcols