If you execute a stored procedure that contains native server syntax SELECT statements, each result set is returned to a separate Visual FoxPro cursor. You can use these cursors to return values or parameters from a stored procedure on a remote server to the Visual FoxPro client.
To return multiple result sets
Use the SQLEXEC( ) Function to select multiple results sets using your native server syntax.
For example, the following code creates and executes a SQL stored procedure on a remote server,
my_procedure, that returns three Visual FoxPro cursors:
=SQLEXEC(nConnectionHandle,'create procedure my_procedure as ; select * from sales; select * from authors; select * from titles') =SQLEXEC(nConnectionHandle,'execute my_procedure')
The SQLEXEC( ) Function enables you to send a SQL statement to the data source without interpretation. In the simplest case, any string you enclose in the second parameter of the SQLEXEC(В ) function is passed to your data source without interpretation. This allows you to execute any statement using your data source's native SQL.
You can also use the SQLEXEC(В ) function to create a parameterized query, or to pass ODBC extensions to SQL to the data source.
Other ResourcesHow to: Access Stored Procedures on Remote Servers with SQL Pass-Through Functions
How to: Create a Parameterized Query
Using SQL Pass-Through Technology
Enhancing Applications Using SQL Pass-Through Technology
Planning Client/Server Applications
Upsizing Visual FoxPro Databases