Discuz教程网

ASP中使用Set ors=oConn.Execute()时获取记录数的方法

[复制链接]
authicon dly 发表于 2011-9-14 09:01:16 | 显示全部楼层 |阅读模式
  1. <%
  2. Dim oConn, ors, aRows
  3. Dim i,j
  4. Set oConn=Server.CreateObject("ADODB.Connection")
  5. oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("database/newasp.resx")
  6. Set ors=oConn.Execute("Select TOP 5 SoftID,SoftName FROM NC_SoftList")
  7. Response.Write "RecordCount:" & ors.RecordCount & "<br/>" '-1
  8. aRows=oRs.GetRows(-1) 'oRs.Eof=True,aRows(col,row)
  9. Set ors=Nothing
  10. oConn.Close()
  11. Set oConn=Nothing

  12. If IsArray(aRows) Then
  13. Response.Write "RecordCount:" & UBound(aRows,2)+1 & "<br/>"
  14. For i=0 To UBound(aRows,2)
  15. For j=0 To UBound(aRows,1)
  16. Response.Write aRows(j,i)
  17. If j<> UBound(aRows,1) Then Response.Write ","
  18. Next
  19. Response.Write "<br/>"
  20. Next
  21. End If
  22. %>
复制代码




上一篇:获取一个数字的个位、十位、百位的函数代码
下一篇:ASP的URLDecode函数URLEncode解码函数
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

1314学习网 ( 浙ICP备10214163号 )

GMT+8, 2025-5-2 10:37

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表