Returns a pointer to the data for a result column.
LPCBYTE dbdata (
PDBPROCESS dproc,
INT column );
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 | dbcoltype |
dbcollen | dbdatlen |
dbcolname | dbnumcols |