Tjena. response.write "<td>" & (rs.Fields(i).name) & "</td>" En For Each loop är att rekomendera:skriva ut kolumnnamn
Har inte fysisk tillgång till en databas så kan inte göra detta manuellt
Jag vill iaf skriva ut hela tabelldatan och överst i en htmltabell skall kolumnnamnen stå
typ:
rs.open ("SELECT * FROM tabelln"), con
response.write "<table><tr>"
for i=0 to (rs.Fields.count -1)
response.write "<td>" & (rs.Fields.name) & "</td>" 'vad skall stå här?
next
response.write "</tr><tr>"
do until RS.EOF
response.write "<tr>"
for j=0 to (rs.Fields.count -1)
response.write "<td>" & rs.Fields(j) & "</td>"
next
response.write "</tr>"
rs.movenext
loop
response.write "</table>"
'Close and clean up
rs.close
con.Close
Set con = Nothing
Set rs = Nothing
JonasSv: skriva ut kolumnnamn
Detta borde nog fungera
/JohanSv: skriva ut kolumnnamn
<code>
Dim fldField
rs.open "SELECT * FROM tabelln", con
Response.write "<table><tr>"
For Each fldField In rs.Fields
Response.write "<td>" & fldField.Name & "</td>"
Next
Do Until RS.EOF
Response.write "</tr><tr>"
For Each fldField In rs.Fields
Response.write "<td>" & fldField.Value & "</td>"
Next
rs.movenext
loop
response.write "</tr></table>"
'Close and clean up
rs.close
Set rs = Nothing
con.Close
Set con = Nothing
</code>