programming-examples/asp/Data_Access_DateTime/Dynamic Table.asp

25 lines
638 B
Plaintext
Raw Normal View History

2019-11-18 14:25:58 +01:00
SQL = "SELECT * FROM MyTable"
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open Application("ConnectionString")
Set RS = Server.CreateObject("ADODB.Recordset")
RS.Open SQL, Conn
fCount = RS.Fields.Count - 1
Response.Write "<table border=1><tr bgcolor='#EEEEEE'>"
for i=0 to fCount
Response.Write "<th>" & RS(i).name & "</th>"
next
Response.Write "</tr>"
While Not RS.EOF
Response.Write "<tr>"
for i=0 to fCount
Response.Write "<td>" & RS(i).value & "</td>"
next
Response.Write "</tr>
RS.MoveNext
Wend
Response.Write "</table>"
RS.Close
Set RS = Nothing
Conn.Close
Set Conn = Nothing