请选择 进入手机版 | 继续访问电脑版
查看: 203|回复: 0

[.NET开发] 简单的函数来返回记录集结果到HTML表格

3万

主题

3万

帖子

10万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
100197
发表于 2015-11-23 17:52:09
<无详细内容>
  1. function ReturnHTMLTable(query)
  2. set rs = cn.Execute(query)
  3. rs.MoveFirst
  4. response.Write "<table class=""data"" cols=""" & rs.Fields.Count & """>"
  5. response.Write "<tr>"
  6. For Each oField In rs.Fields
  7. response.Write "<th>" & oField.Name & "</th>"
  8. Next
  9. response.Write "</tr>"
  10. Do While Not rs.EOF
  11. response.Write "<tr>"
  12. For Each oField In rs.Fields
  13. response.Write "<td>"
  14. If IsNull(oField) Then
  15. response.Write " "
  16. Else
  17. response.Write oField.Value
  18. End If
  19. response.Write "</td>"
  20. Next
  21. rs.MoveNext
  22. response.Write "</tr>"
  23. Loop
  24. response.Write "</table>"
  25. end function
复制代码


回复

使用道具 举报