Click or drag to resize

Functions.SetResultSet Method

-- todo --
Marks a cursor as a result set in the current data session.
Only one cursor per data session can be marked. When marking a new cursor, SetResultSet( ) clears the marker from any previously marked cursor.

Namespace:  XSharp.VFP
Assembly:  XSharp.VFP (in XSharp.VFP.dll) Version: 2.17
 FUNCTION SetResultSet(
Request Example View Source


uArea (Optional)
Type: Usual
Specifies a work area number.
Specifies the alias of the cursor you want to mark.

Return Value

Type: Long
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.
SetResultSet( ) is supported in X# and the X# OLE DB Provider. You can use SetResultSet( ) in a database container (DBC) stored procedure or send it to the X# 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:
1oRecordSet = oConn.Execute("SetResultSet('MyCursor')")
By using SetResultSet( ) to mark a cursor or table opened by the X# 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. 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:
1RETURN SetResultSet("MyCursor")
This statement creates and returns a rowset from the marked cursor, not the return value from SetResultSet( ).
See Also