次の方法で共有


SQLMORERESULTS( ) Function

Copies another result set to a Visual FoxPro cursor if more result sets are available.

SQLMORERESULTS(nConnectionHandle)

Return Values

Numeric

Parameters

  • nConnectionHandle
    Specifies the connection handle to the data source returned by SQLCONNECT( ).

Remarks

SQLMORERESULTS( ) determines if more result sets are available from a SQL statement executed with SQLEXEC( ) in non-batch mode. If more result sets are available, they are copied to a Visual FoxPro cursor, one set at a time.

SQLMORERESULTS( ) returns 0 if the SQL statement is still executing, returns 1 if it is finished executing, and returns 2 if no more data is found. In non-batch mode, SQLMORERESULTS( ) should be called after each successful SQLEXEC( ) call until SQLMORERESULTS( ) returns 2 (no more data found). The setting of the SQLSETPROP( ) batch mode option determines whether SQLEXEC( ) executes a SQL statement in batch or non-batch mode.

SQLMORERESULTS( ) returns – 1 if a connection level error occurs, and returns – 2 if an environment level error occurs.

SQLMORERESULTS( ) 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 SQLMORERESULTS( ) repeatedly until it returns a value other than 0 (still executing).

Example

The following example assumes SQLCONNECT( ) is successfully issued, and its return value is stored to a memory variable named gnConnHandle. SQLSETPROP( ) is used to set the BatchMode property to false (.F.) so the individual result sets can be retrieved.

SQLMORERESULTS( ) is issued twice to create two cursors containing the results of the SQLEXEC( ) query. SET is used to display the View window and the cursors created by SQLEXEC( ).

= SQLSETPROP(gnConnHandle, 'BatchMode', .F.)  && Individual result sets
= SQLEXEC(gnConnHandle, 'SELECT * FROM authors;
   SELECT * FROM titles')
= SQLMORERES(gnConnHandle)  && First result set
= SQLMORERES(gnConnHandle)  && Second result set

See Also

AERROR( ) | SQLCANCEL( ) | SQLCONNECT( ) | SQLEXEC( ) | SQLGETPROP( ) | SQLSETPROP( )