dbtabsource

Returns the name and number of the table from which a particular result column was derived.

Syntax

LPCSTR dbtabsource (
PDBPROCESS
dbproc,
INT
colnum,
LPINT
tabnum );

where

dbproc
Is the DBPROCESS structure that is the handle for a particular workstation/ SQL Server process. It contains all the information that DB-Library uses to manage communications and data between the workstation and SQL Server.
colnum
Is the number of the result column. Column numbers start at 1.
tabnum
Is a pointer to an integer, which is filled in with the table's number. Many DB-Library functions that deal with browse mode accept either a table name or a table number. If dbtabsource returns NULL (see the next section, "Returns"), tabnum is set to -1.

Returns

A pointer to the name of the table from which this result column was derived. A NULL return value can mean one of the following:

Remarks

The dbtabsource function is one of the DB-Library browse-mode functions. For a detailed discussion of browse mode, see Browse Mode in Programming with DB-Library.

The dbtabsource function allows an application to determine which tables provided the columns in the current set of result rows. This information is valuable when using dbqual to construct WHERE clauses for UPDATE and DELETE statements based on ad hoc queries. If the query has been hardcoded into the program, this function is unnecessary.

The dbtabsource function can be called any time after dbresults.

See Also

dbcolbrowse, dbcolsource, dbqual, dbresults, dbtabbrowse, dbtabcount, dbtabname, dbtsnewlen, dbtsnewval, dbtsput; Bulk-Copy Functions