本文实例讲述了VB返回记录集结果到HTML表格的方法。分享给大家供大家参考。具体实现方法如下:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
function ReturnHTMLTable(query)
set rs = cn.Execute(query)
rs.MoveFirst
response.Write "<table class=" "data" " cols=" "" & rs.Fields.Count & "" ">"
response.Write "<tr>"
For Each oField In rs.Fields
response.Write "<th>" & oField.Name & "</th>"
Next
response.Write "</tr>"
Do While Not rs.EOF
response.Write "<tr>"
For Each oField In rs.Fields
response.Write "<td>"
If IsNull(oField) Then
response.Write " "
Else
response.Write oField.Value
End If
response.Write "</td>"
Next
rs.MoveNext
response.Write "</tr>"
Loop
response.Write "</table>"
end function
|
希望本文所述对大家的VB程序设计有所帮助。