SetRecordSet

Description

Sets an ADOResultSet object to obtain its data and metadata from a passed ADO Recordset.

Applies to

ADOResultSet objects

Syntax

adoresultset.SetRecordSet ( adorecordsetobject )

Argument

Description

adoresultset

An ADOResultSet object into which the function places the passed ADO Recordset.

adorecordsetobject

An OLEObject object that contains an ADO Recordset. Passing an OLEObject that does not contain an ADO Recordset generates an error.


Return value

Integer.

Returns 1 if it succeeds and -1 if an error occurs.

Usage

Use the SetRecordSet function to populate an ADOResultSet object with data passed in an OLEObject that contains an ADO Recordset. Record sets are returned from COM+ components as ADO Recordsets.

Examples

The following example connects to a COM+ component and calls a method on the component that returns an ADO Recordset to an OLEObject object. Then it creates an ADOResultSet object and populates it with data from the OLEObject using SetRecordSet:

OLEObject loo_mycomponent
OLEObject loo_ADOrecordset
ADOresultset lrs_ADOresultset
integer li_rc
 
loo_mycomponent = CREATE OLEObject
li_rc = loo_mycomponent.ConnectToNewObject("PB.Test")
IF li_rc <> 0 THEN
      MessageBox("Connect Failed", string(li_rc) )
      RETURN
END IF
 
// Use an OLEObject to hold ADO Recordset
// returned from method on COM+ component
loo_ADOrecordset = loo_mycomponent.GetTestResult()
 
// Create an ADOResultSet and get its data
// from OLEObject holding passed ADO Recordset
lrs_ADOresultset = CREATE ADOResultSet
lrs_ADOresultset.SetRecordSet(loo_ADOrecordset)
 

See also

CreateFrom method for DataWindows in the section called “CreateFrom” in DataWindow Reference.

GenerateResultSet method for DataWindows in the section called “GenerateResultSet” in DataWindow Reference.

GetRecordSet

SetResultSet