Link to home
Start Free TrialLog in
Avatar of bradyj
bradyj

asked on

Returning Recordset Data in a 3 tier client server database application

I have a 3 tier vb database application.
Client App <-> ActiveX DLL Server App <-> Database
The client calls the Server requesting a list of say client codes from the Database. The server contains properties and methods for access the database. The server queries the database and retrieves a recordset containing client codes. How can I pass back the entire recordset to the client app ? It is not possible to assign a function a return value of a recordset.
Avatar of bradyj
bradyj

ASKER

Adjusted points to 200
The client can pass a recordset object by reference, and the server can set the argument to the recordset:

'Server:
Sub GetRecordset(Rs as recordset)
 Set Rs=Database.openrecordset("whatever")
End Sub

'Client
Dim R as recordset
Srv.GetRecordset R

Avatar of bradyj

ASKER

I'm not sure if you read the question correctly:

Your proposal passes a Recordset from the Client to the Server.

I want the Server to pass a recordset as a Return Value from a function back to the Client.

ie. Server -> Recordset -> Client

NOT Client -> Recordset -> Server


eg. Server function

Public Function GetData as Recordset

ie. the return value of the Function is a Recordset. You will see hthat this is not allowed. Therefore how can I pass back a recordset ?

The client passes an empty recordset, a pointer. The server constructs the recordset, and returns it in it's param. After the GetData() call, Rs will be the recordset passed back by the server. Try and see for yourself
My understanding is that this *is* possible in VB6... is that an option for you?

If not, I've seen code that passes a ComboBox (Control datatype) to the server, allowing the server to populate the control...

Larry
ASKER CERTIFIED SOLUTION
Avatar of vspeter
vspeter

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial