Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Can a recordset object be passed from a component to client

Can a recordset object be passed from a component to client

Can a recordset object be passed from a component to client

I want to execute a query thru MTS component from vb client.
But i want to get the whole recordset object from the component
How can i do it?

Thanx and regards,

RE: Can a recordset object be passed from a component to client

no problem,

write a function in the mts class that gets a recordset by refferance. do the query, and at the end set the recordset activeconnection to nothing (it becumes a disconected recordset, and then you can pass it)


public sub dosmething (rs as recordset)
sql="select * from tsble"
rs.open sql,myconnection
set rs.activeconnection=nothing
end sub

RE: Can a recordset object be passed from a component to client

   Zeevgetner is very close to the actual solution. I would suggest a few changes. Rather than passing a recrdset reference up to the server (I.E. More data to marshal), create the recordset in the server component and return it from a function. Also, make sure that the server is set to be a client side cursor and not a server side cursor (the default).
   Finally, this will only work if you are using ADO. If you are using DAO recordsets, they will not marshal.
   Here is some sample code for the Server Component . . .

Public Function GetMyData() As ADODB.Recordset

   Dim artData As ADODB.Recordset
   Dim strSQL As String
   Dim strConnection As String
   strSQL = "select * from tsble"
   strConnection = "Your Connection String"
   Set artData = New ADODB.Recordset
   With artData
      .CursorLocation = adUseClient
      .Openopen strSQL, strConnection
      Set .ActiveConnection = Nothing
   End With

   Set GetMyData = artData

End Function

And then from your client application

Dim obj As MyLib.MyClass
Dim artData as ADODB.Recordset

Set obj = CreateObject("MyLib.MyClass")
set artData = obj.GetMyData
Set obj = Nothing

- Jeff Marler

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close