Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 273
  • Last Modified:

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.
0
bradyj
Asked:
bradyj
1 Solution
 
bradyjAuthor Commented:
Adjusted points to 200
0
 
MikeP090797Commented:
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

0
 
bradyjAuthor Commented:
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 ?

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
MikeP090797Commented:
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
0
 
StapleheadCommented:
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
0
 
vspeterCommented:
I guess, you want to return the recordset back to the client so you can manipulate it on the client. But you've got to ask yourself, what can i do with this recordset WITHOUT the connection handle ?. Because from what you describe, the 'Server' holds everything in term of database connection, queries ...etc, to retrieve data from the database.

My answer is that you can not have recordset as returned type (I guess Microsoft didn't allow you to do that because the recordset does not hold any information regarding the connection handle that was used).

I would probably use the same technique suggested by MikeP and Staplehead using array where you can dynamically resize if need.
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now