HOWTO: Accessing The Recordset DTC's Underlying ADO Recordset
ID: Q193231
|
The information in this article applies to:
-
Microsoft Visual InterDev, version 6.0
SUMMARY
The underlying ActiveX Data Objects (ADO) Recordset created when a
Recordset Design-time control (DTC) is included on an Active Server Page
(ASP) can be accessed from ASP script using the getRecordSource() method of
the Recordset Design-Time Control.
MORE INFORMATION
The getRecordSource() method of the Recordset DTC returns a copy of the ADO
Recordset that is the source of the Recordset DTC. The following example
sets an object to be the source ADO Recordset of a Recordset DTC and
creates an HTML table of the field names and values.
- Open a project in Visual InterDev 6.0 and add a Data Connection (if one
does not already exist).
- Add an Active Server Page to the project.
- Insert a Recordset DTC in the Active Server Page after the <BODY> tag.
- Right-click the Recordset DTC and select Properties.
- Set the Name to "Recordset1," the Source of Data to "Database object,"
and the database object to "Tables." Set the Object Name to a table of
your choice.
- To access the Recordset generated by the Recordset DTC from ASP, insert
the following VBScript code after the Recordset DTC:
<%
'
'Where Recordset1 is the name of your Recordset DTC
'
Dim tempRS
Set tempRS = Recordset1.getRecordSource()
Response.Write "<table border=1 cellpadding=4>"
Response.Write "<tr>"
For I = 0 To tempRS.Fields.Count - 1
Response.Write "<td><b>" & tempRS(I).Name & "</b></td>"
Next
Response.Write "</tr>"
Do While Not tempRS.EOF
Response.Write "<tr>"
For I = 0 To tempRS.Fields.Count - 1
Response.Write "<td>" & tempRS(I) & "</td>"
Next
Response.Write "</tr>"
tempRS.MoveNext
Loop
Response.Write "</table>"
Set tempRS = Nothing
%>
This is just one example of the capability available. Once you have the ADO
Recordset object, all of the ADO Recordset methods and properties are
available.
Additional query words:
Keywords : kbADO kbCtrl kbVisID600 kbGrpASP
Version : WINDOWS:6.0
Platform : WINDOWS
Issue type : kbhowto