Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Pass ADO RecordSet by Value
Message
 
To
02/07/2001 12:06:33
Len Wooden
Statistical Resources, Inc
Baton Rouge, Louisiana, United States
General information
Forum:
Visual Basic
Category:
Database DAO/RDO/ODBC/ADO
Miscellaneous
Thread ID:
00525925
Message ID:
00525943
Views:
24
Martin/Len:

Is it possible that there is another type of reference that includes a RecordSet object? Typically, my "as RecordSet" clauses actually say "as ADODB.RecordSet" to avoid any confusion with some legacy DAO stuff (the old VB/Access connectivity technology).

Just a thought... see if that works. I'd suggest it in a few places below -- my changes are on the lines that end with "'-VM Change-"


---------- Original Message --------------
I have a compiled ActiveX EXE registered on the server computer named test05.exe.
It contains 1 Class called Class1 with 2 functions defined as follows:

Public Function getrset() As ADODB.Recordset '-VM Change-
Dim rs2 As ADODB.Recordset '-VM Change-
Set rs2 = New ADODB.Recordset '-VM Change-
With rs2
.Fields.Append "lname", adBSTR, 12
.Fields.Append "fname", adBSTR, 12
.CursorLocation = adUseClient
.Open , , adOpenStatic, adLockBatchOptimistic
.AddNew
.Fields("lname") = "aabvbv"
.Fields("fname") = "zzssee"
.UpdateBatch
End With
Set getrset = rs2
Set rs2 = Nothing
End Function

Public Function bob() As String
bob = "zzzzzzzzzzzzzaaaaaa"
End Function

The test05.exe file was compiled on the server machine and the project has a reference to the msado20.tlb.


I have copied the .vbr and .tlb files to the client computer and placed the .tlb file in the
c:\windows\system directory, and the .vbr file in a directory called c:\coms. I then ran
clireg32.exe on the .vbr file and set the information for the server as follows:

Remote Transport = Remote Automation
Network Address: dev-sqlserver (The name of the server computer)
Protocol: ncacn_nb_nb

I then start a new Standard EXE project on the client computer and set a reference to the test05.tlb file.
I also set a reference to the msado20.tlb. The project has 1 form with 2 command buttons with code as follows:

Private Sub Command1_Click()
Dim rs As Recordset
Dim xobj As object
Set xobj = createobject("test05.class1")
Set rs = xobj.getrset
MsgBox rs.Fields("lname").Value
End Sub

Private Sub Command2_Click()
Dim aa as String
Dim xobj As object
Set xobj = createobject("test05.class1")
aa = xobj.bob
MsgBox aa
End Sub

First I run the Automation Manager on the server computer. Then I run the project on the client computer and
click the second button. I get a single connection to the server and the string is returned and displayed in
the message box. If I click the first button I get a single connection and get the following error:


Microsoft Visual Basic

Run-time error '445':

Object doesn't support this action


If I press the Debug command button on the error box the line "Set rs = xobj.getrset" is the line in question.
Both the server computer and the client computer have VB 6 (SP 3) installed. The server is running Win2000 Advanced
Server and the client is running Win98 second edition. I am getting this code out of a book which tells me the
server should send the recordset back to the client by value and allow me to sever my connection to the server and
still have the recordset client side to work with. Is this true, and if so what am I doing wrong?

Thanks in advance
-- Martin Parker (via Len Wooden)
The whole problem with the world is that fools and fanatics are always so certain of themselves, but wiser people so full of doubts. - Bertrand Russell
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform