/ Published in: ASP

show a table with data and his column name
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<% Set Conn = Server.CreateObject("ADODB.Connection") Set rst = Server.CreateObject("ADODB.Recordset") Conn.Open Application("ConnectionString") Dim temp Dim i temp =0 response.write "<table>" do while not rst.eof For i = 0 To rst.fields.count - 1 If temp = 0 Then If i = 0 then response.write "<tr><td></td>" response.write "<th>" & rst(i).name & "</th>" If i = rst.fields.count - 1 then response.write "</tr>" End If Next For i = 0 To rst.fields.count - 1 If i = 0 then response.write "<tr><td>" & temp & "</td>" response.write "<td>" & rst(i) response.write("</td>") If i = rst.fields.count - 1 then response.write "</tr>" Next temp = temp + 1 rst.movenext loop response.write "</table>" rst.close set rst=nothing %>
Comments
