Compartir a través de


How to: Use 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 the SQLCANCEL( ) Function or with the asynchronous functions — 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

Concepts

Selecting an Efficient SQL Pass-Through Processing Mode

Processing Multiple Result Sets

Working with Remote Data Using SQL Pass-Through

Other Resources

Enhancing Applications Using SQL Pass-Through Technology

Planning Client/Server Applications

Upsizing Visual FoxPro Databases

Creating Views