Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing an ADO Recordset as a parameter

Status
Not open for further replies.

PTW

Programmer
Jul 7, 2000
82
CA
Is it possble to pass an ADO recordset to a Sub or Function?<br><br>For example:<br><br>' Call the Sub<br>MySub(rsMyRecordset)<br><br>' Then the Sub will have the following:<br>Sub Mysub(ByVal rsLocalRecordset as ADODB.Recordset)<br><br><br>I have not had much success coding it this way.&nbsp;&nbsp;Am I making some kind of mistake, or is there another way to pass an entire recordset to Sub or Function?<br><br>Thanks for any help!<br><br>
 
What you have done should work but I also had problems with that method. <br><br>The way that I normally do it is to pass it as an object <br><br>Private MySub(Rs as object)<br><br>dim MyRs as adodb.recordset <br><br>then when inside the sub set the object = to a recordset <br><br>set MyRs = Rs <br><br>Hope this solves your problems
 
Since all of our architecture is multi-tier, we routinely pass recordsets between routines, modules and machines. We always convert the recordset into an array and pass the array as a variant, then work with the array at the receiving end. In the UI tier we always populate controls from arrays so this is our most convenient form for the data.

Of course our design activity keeps in mind the performance issues that passing large arrays might bring. Our data access tier always resides on the same machine as the database, and typically only smaller arrays need to be passed forward across machines.

Just another suggestion.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top