/ Published in: ASP
show a table with data and his column name
Expand |
Embed | Plain Text
<% 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
Subscribe to comments
You need to login to post a comment.

If Not ReportRS.EOF Then Response.Write("") Response.Write("") For Each field in ReportRS.fields Response.Write("" & field.name & "") Next Response.Write("") Do While Not ReportRS.EOF Response.Write("") For Each field in ReportRS.fields Response.Write("" & ReportRS(field.name) & "") Next Response.Write("") ReportRS.MoveNext Loop Response.Write("") End If
what?