SqlColSource$

Returns the name of the database column from which a result column derives.

Syntax

SqlColSource$ ( sqlconn%, tabnum% )

where

sqlconn% ( )
Is a SQL Server connection. The value of sqlconn% is returned by SqlOpen%.
tabnum%
Is the number of the table. The first table is number 1.

Returns

A string containing the name of the database column from which a specified result derives. SqlColSource$ returns an empty string if the column number is out of range or if the column is the result of a Transact-SQL expression, such as MAX(colname).

Remarks

SqlColSource$ is a DB-Library for Visual Basic browse-mode function. For a detailed discussion of browse mode, see DB-Library for Visual Basic Programming. SqlColSource$ is useful for ad hoc queries. When a query has been hard-coded into the application, SqlColSource$ is unnecessary. SqlColSource$ returns the underlying database column name. Don't confuse this column name with the optional column headings you can specify with a SELECT statement. For example, the following statement specifies a column header of "author" for the au_lname column:

SELECT author = au_lname FROM authors 

When updating a table, use the database column name, not the header name. The following code fragment uses SqlColSource$ to get the underlying database column name:

Source$ = SqlColSource$(Sqlconn%, 1)

You can call SqlColSource$ any time after you call SqlResults%.

See Also

SqlColBrowse%, SqlQual$, SqlTabBrowse%, SqlTabCount%, SqlTabName$, SqlTabSource$, SqlTsNewLen%, SqlTsNewVal$ and SqlTsNewVal&, SqlTsPut%