SetRecordSet PowerScript function
Description
Sets an ADOResultSet object to obtain its data and metadata
from a passed ADO Recordset.
Controls
ADOResultSet objects
Syntax
1 |
<span>adoresultset</span>.<span>SetRecordSet</span> ( <span>adorecordsetobject </span>) |
Argument |
Description |
---|---|
adoresultset |
An ADOResultSet object into which the |
adorecordsetobject |
An OLEObject object that contains an |
Return Values
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:
1 |
OLEObject loo_mycomponent |
1 |
OLEObject loo_ADOrecordset |
1 |
ADOresultset lrs_ADOresultset |
1 |
integer li_rc |
1 |
1 |
loo_mycomponent = CREATE OLEObject |
1 |
li_rc = loo_mycomponent.ConnectToNewObject("PB.Test") |
1 |
IF li_rc <> 0 THEN |
1 |
MessageBox("Connect Failed", string(li_rc) ) |
1 |
RETURN |
1 |
END IF |
1 |
1 |
// Use an OLEObject to hold ADO Recordset |
1 |
// returned from method on COM+ component |
1 |
loo_ADOrecordset = loo_mycomponent.GetTestResult() |
1 |
1 |
// Create an ADOResultSet and get its data |
1 |
// from OLEObject holding passed ADO Recordset |
1 |
lrs_ADOresultset = CREATE ADOResultSet |
1 |
lrs_ADOresultset.<span>SetRecordSet</span>(loo_ADOrecordset) |
1 |
See Also
-
CreateFrom method
for DataWindows in the DataWindow Reference or the online Help -
GenerateResultSet method
for DataWindows in the DataWindow Reference or the online Help