How To Pass a Recordset From a VB Component to an ASP Page, Part 2
By Doug Dean
In Part 1 we looked at creating the VB server-side DLL. In this part we'll look at the ASP page that obtains the disconnected recordset from the VB component in Part 1!
THE ASP FILE - How2Project1.asp
We'll need to instantiate the VB object within the asp file with the following statement and then assign
values to the two parameters used in the method.
|
Literal constant values could be used directly within the method definition, but this can get messy when more
than a few arguments are used.
Since we're calling a method that returns a RecordSet object (remember, Set was used for sending
the RecordSet object in our VB code), we'll need to use Set for assigning the object variable
(oRecordSet) we use here in our asp code to accept the sent RecordSet.
'~~~~~~~~~~~~~~ Get Detached RecordSet ~~~~~~~~~~
|
Now we have a RecordSet object variable that can be used to obtain the database field values. In this example,
we'll loop though the records and use the Response.Write method to send the values back to any
visiting browser as HTML text. The two returned ExampleField1 and ExampleField2 fields
values from the Example1 database will be displayed like this…
|
Here's the asp code that lists the fields…
|
Happy Programming!
Attachments:




