Share via


Using SQL Pass-Through Asynchronously

Your application can request asynchronous processing for the four functions that submit requests to a data source and retrieve data: SQLEXEC( ), SQLMORERESULTS( ), SQLTABLES( ), and SQLCOLUMNS( ). You enable asynchronous processing by setting the Asynchronous property of the connection with the SQLSETPROP( ) function. When asynchronous communication is established for the connection, all four of these functions operate asynchronously.

To check the setting of the Asynchronous property

  • Use the SQLGETPROP( ) function to view the Asynchronous property setting. In the following example, nConnectionHandle represents the handle number for your active connection:

    ? SQLGETPROP(nConnectionHandle,'Asynchronous')
    

To enable asynchronous processing

  • Use the SQLSETPROP( ) function to specify the Asynchronous property:

    ? SQLSETPROP(nConnectionHandle,'Asynchronous', .T.)
    

In Asynchronous mode, you must call each function repeatedly until it returns a value other than 0 (still executing). While the function is still executing, you can cancel processing of the function by pressing the ESC key if the SET ESCAPE property is set to true (.T.).

Until the function has finished processing, the application can use a connection handle only with SQLCANCEL( ) or with the asynchronous function — SQLEXEC( ), SQLMORERESULTS( ), SQLTABLES( ), or SQLCOLUMNS( ) — originally associated with the handle. You can't call any of the other three asynchronous functions or SQLDISCONNECT( ) with the same connection handle until the function has finished.

See Also

Selection of an Efficient SQL Pass-Through Processing Mode | Processing of Multiple Result Sets | Working with Remote Data Using SQL Pass-Through | Implementing a Client/Server Application | Designing Client/Server Applications | Upsizing Visual FoxPro Databases | Creating Views