SqlColumns Function | |
Stores a list of column names and information about each column for the specified data source table to a X# cursor.
Namespace:
XSharp.VFP
Assembly:
XSharp.VFP (in XSharp.VFP.dll) Version: 2.19
Syntax FUNCTION SqlColumns(
nStatementHandle AS LONG,
cTableName AS STRING,
cType AS STRING,
cCursorName AS STRING
) AS USUAL
public static Usual SqlColumns(
int nStatementHandle,
[DefaultParameterValueAttribute("", 0)] string cTableName,
[DefaultParameterValueAttribute("FOXPRO", 0)] string cType,
[DefaultParameterValueAttribute("SQLRESULT", 0)] string cCursorName
)
Request Example
View SourceParameters
- nStatementHandle
- Type: Long
Specifies an active statement handle.
- cTableName
- Type: String
Specifies the name of the table from which the column names are returned. TableName can contain the wildcard characters ? and *.
The question mark (?) matches any single character and the asterisk (*) matches any number of characters.
- cType
- Type: String
This specifies the format for the column information in the result set. The value must be either "Foxpro" or "Native"
The Native format option stores column information for tables in the same format as the data source. The Foxpro format option stores the column information
in the same format as that used for the X# table or cursor that would be created if you imported the data source table into X#. If you omit Foxpro or Native,
the format option defaults to Foxpro.
The table in the remarks section shows the columns in the result set for the Foxpro format.
- cCursorName
- Type: String
Specifies the name of the X# cursor for the result set. If you do not include a cursor name, X# uses the default name SQLRESULT.
Return Value
Type:
Usual
Numeric or Logical.
SqlColumns( ) returns 1 if the cursor is successfully created, 0 if
SqlColumns( ) is still executing,
– 1 if a connection level error occurs, and – 2 if an environment level error occurs.
Remarks SqlColumns( ) is one of the four functions that you can execute either synchronously or asynchronously.
The Asynchronous setting of
SqlSetProp( ) determines if these functions execute synchronously or asynchronously. In asynchronous mode,
you must call
SqlColumns( ) repeatedly until a value other than false (.F.) (still executing) is returned.
Column name | Description |
---|
Field_name | Column name |
Field_type | Column data type |
Field_len | Column length |
Field_dec | Number of decimal places |
The columns in the result set for the Native format depend on the data source. If the table you specify with cTableName does not exist and the format is set
to Native,
SqlColumns( ) returns true (.T.) and creates an empty table or cursor. If the table you specify with cTableName does not exist and the
format is set to Foxpro,
SqlColumns( ) returns false (.F.).
Examples 1= SqlColumns(gnHandle, 'authors', 'Foxpro', 'MyCursor')
See Also