SqlTables Function | |
Stores the names of tables in a data source to a X# cursor.
Namespace:
XSharp.VFP
Assembly:
XSharp.VFP (in XSharp.VFP.dll) Version: 2.21
Syntax FUNCTION SqlTables(
nStatementHandle AS LONG,
cTableTypes AS STRING,
cCursorName AS STRING
) AS LONG
public static int SqlTables(
int nStatementHandle,
[DefaultParameterValueAttribute("", 0)] string cTableTypes,
[DefaultParameterValueAttribute("SQLRESULT", 0)] string cCursorName
)
Request Example
View SourceParameters
- nStatementHandle
- Type: Long
Specifies the statement handle to the data source returned by SqlConnect( ).
- cTableTypes
- Type: String
Specifies one or more table types. Valid table types are 'Table,' 'View,' 'System Table,' or any valid data source-specific table type identifier.
If you include a list of table types, separate the table types with commas.
All table names in the data source are selected if you omit cTableTypes or if cTableTypes is the empty string.
The table type you specify must be delimited with single quotation marks. The following example demonstrates how to specify the 'View'
and 'System Table' table types as a string literal.
1? SqlTables(handle, "'View', 'System Table'", "mydbresult")
- cCursorName
- Type: String
Specifies the name of the X# cursor to which the result set is sent. If you don't include a cursor name, X# uses the default name SQLRESULT.
The structure of the results depends on the internal SqlTables( ) function for the ODBC Handle.
Return Value
Type:
Long
Numeric. SqlTables( ) returns 1 if the cursor is successfully created, 0 if SqlTables( ) is still executing, – 1 if a connection level error occurs,
and – 2 if an environment level error occurs.
Remarks
SqlTables( ) is one of the four functions that you can execute either synchronously or asynchronously.
The setting of the SqlSetProp( ) asynchronous option determines if these functions execute synchronously or asynchronously.
In asynchronous mode, you must call SqlTables( ) repeatedly until it returns a value other than False (.F.), meaning the function is still executing.
Examples 1STORE SqlConnect('MyFoxSQLNT', '<userid>', '<password>') TO gnConnHandle
2IF gnConnHandle < 0
3= MessageBox('Cannot make connection', 16, 'SQL Connect Error')
4ELSE
5= MessageBox('Connection made', 48, 'SQL Connect Message')
6STORE SqlTables(gnConnHandle, 'Table', 'mycursor') TO nTables
7IF nTables = 1
8Select mycursor
9LIST
10ENDIF
11ENDIF
See Also