Syntax 1 For generating an EAServer result set or an ADO Recordset – PB Docs 126

Syntax 1 For generating an EAServer result set or an ADO Recordset


Generates a result set from data in a DataStore or DataWindow

In PowerBuilder, when the result set is generated in a component
on a transaction server, the format of the result set is determined
by the server—TabularResults in EAServer and
ADO Recordset on MTS.


DataWindow type

Method applies to


DataStore object






The name of the DataStore object that
contains the data to be returned in the result set.


The ResultSet object into which the data
in the DataStore is written. This value is passed by reference.

dwbuffer (optional)

A value of the dwBuffer enumerated datatype
identifying the DataWindow buffer containing the data for the result
set. The default is the primary buffer.

For a list of valid values, see DWBuffer.

Return Values

Returns 1 if it succeeds and –1 if it fails. If any
argument is null, it returns null.


How to use it

Result sets are intended for exchanging data between a DataStore
and some data-aware application that does not use DataWindow technology.
With result sets, the receiving end does not support updating of
the data.

The GenerateResultSet method is typically
used in a PowerBuilder custom class user object that has been packaged
as a component on EAServer or on
an MTS server. A function in the user object generates a result
set from information that has been retrieved into a DataStore. The
function then returns the result set or passes it to another method.

For example, a function for PowerBuilder custom class user
object running in a transaction server can retrieve data into a
DataStore object, create a result set object, and return the result
set. A client application calls the function to get the data. The
client application must be able to handle result sets, but it does
not need to have support for DataWindow technology.

Likewise, a client application can generate a result set from
a DataStore and pass the result set to the server.

The CreateFrom method can convert a result
set back to a DataStore.

Result set format

The result set is returned to a client in a format that is standard
for the server. In user objects deployed to EAServer, user-defined functions
that return a PowerBuilder ResultSet object are represented in the
IDL definition of the component as methods that return a result
set of type TabularResults::ResultSet. Multiple result sets returned
in a ResultSets object are represented in the IDL as TabularResults::ResultSets datatypes.
In MTS, returning a result set created by GenerateResultSet causes
an ADO Recordset to be marshaled to the client.

The GenerateResultSet method can also be
called in a client application. Since the format of the result set
depends on the server on which it is used, the format is fixed when
that result set is passed to a server. For EAServer, the
format is TabularResults::ResultSet; for MTS, the format is an ADO Recordset.

note.png Destroying or modifying the DataStore

The generated ResultSet object maintains a reference to the
DataStore from which it was generated, so changes made to the DataStore
object after the result set is generated will be reflected in the
generated ResultSet object. If you destroy the DataStore object
before returning the result set, the result set becomes invalid.
You can rely on garbage collection to destroy the DataStore object
or destroy it explicitly in the component’s deactivate

Other data exchange techniques

To exchange data between a DataWindow on a client and a DataStore
on EAServer, use the data–synchronizing
methods GetFullState and SetFullState.
With these methods, both controls remain updatable. If updating
is not a concern, you still might choose result sets instead of
synchronizing methods because result sets transfer less data.


In this example, a DataStore object is created and
data is retrieved into it, and then the GenerateResultSet method
is used to create a result set that can be returned to a client.

See Also

  • CreateFrom

  • SetRecordSet in PowerScript

Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Notify of
Inline Feedbacks
View all comments
Would love your thoughts, please comment.x