Marks a cursor as a result set in the current data session.
Note: |
---|
Only one cursor per data session can be marked. When marking a new cursor, SETRESULTSET(В ) clears the marker from any previously marked cursor. |
SETRESULTSET( nWorkArea | cTableAlias ) |
Parameters
- nWorkArea
- Specifies a work area number.
- cTableAlias
- Specifies the alias of the cursor you want to mark.
Return Value
Numeric. SETRESULTSET(В ) returns the number of the work area of the previously marked cursor in the current data session or zero (0) if no cursor is marked in the current data session.
Remarks
SETRESULTSET(В ) is supported in Visual FoxPro and the Visual FoxPro OLE DB Provider. You can use SETRESULTSET(В ) in a database container (DBC) stored procedure or send it to the Visual FoxPro OLE DB Provider, assuming that the cursor has been previously opened by the OLE DB Provider. For example, suppose a previous command opens a cursor named MyCursor in the OLE DB Provider. The following line of code retrieves an ADO RecordSet for the cursor, MyCursor:
В | Copy Code |
---|---|
oRecordSet = oConn.Execute("SETRESULTSET('MyCursor')") |
By using SETRESULTSET(В ) to mark a cursor or table opened by the Visual FoxPro OLE DB Provider, you can retrieve a rowset created from the table or cursor from a database container (DBC) stored procedure. When the OLE DB Provider completes command execution, it creates a rowset from the marked cursor, if it exists, then clears the marker flag from the cursor.
Note: |
---|
In this scenario, the OLE DB Provider disregards all other return values. For example, if a stored procedure contains a RETURNВ Value statement and a marked cursor, the OLE DB Provider does not return the value. Instead, it returns the marked cursor as a rowset to the calling application. When the rowset closes, the cursor also closes. |
However, even though the OLE DB Provider disregards all return values when a marked cursor exists, you can use SETRESULTSET(В ) with the RETURN command. For example:
В | Copy Code |
---|---|
RETURN SETRESULTSET("MyCursor") |
This statement creates and returns a rowset from the marked cursor, not the return value from SETRESULTSET(В ).