How to dynamically create a HTML table from an ADO recordset !.
Shows how to dynamically create a HTML table from a recordset. All you need is the connection string and the table name.
AI
Resumen de IA: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
Código fuente
<XMP>
**********************************************************************
How to dynamically create a html table from an ADO recordset !.
All you need is your connection string and Table name, and
off you go !.
**********************************************************************
<%
Dim conn
Dim cmd
Dim rs
Set conn = Server.CreateObject("ADODB.Connection")
Set cmd = Server.CreateObject("ADODB.Command")
cmd.ActiveConnection = "Provider = MSDASQL;Data Source=Northwind;Database=Northwind;User Id=;Password=;"
cmd.CommandText = "SELECT * FROM Customers"
Set rs = cmd.Execute
Response.Write "<table width=100% border=1>"
Response.Write "<tr>"
for i = 1 to rs.Fields.Count - 1
Response.Write "<td><strong>" & rs.Fields(i).Name & "<strong></td>"
next
Response.Write "</tr>"
Do While Not rs.EOF
Response.Write "<tr>"
for i = 1 to rs.Fields.Count - 1
Response.Write "<td>" & rs.Fields(i) & "</td>"
next
rs.MoveNext
Response.Write "</tr>"
Loop
Response.Write "</table>"
%>
</XMP>
Comentarios originales (3)
Recuperado de Wayback Machine