Solved

Returning Recordset Data in a 3 tier client server database application

Posted on 1998-10-05
6
229 Views
Last Modified: 2013-12-25
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
Comment
Question by:bradyj
6 Comments
 

Author Comment

by:bradyj
ID: 1496631
Adjusted points to 200
0
 
LVL 8

Expert Comment

by:MikeP090797
ID: 1496632
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
 

Author Comment

by:bradyj
ID: 1496633
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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 8

Expert Comment

by:MikeP090797
ID: 1496634
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
 
LVL 1

Expert Comment

by:Staplehead
ID: 1496635
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
 
LVL 2

Accepted Solution

by:
vspeter earned 200 total points
ID: 1496636
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question