欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

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

程序员文章站 2022-05-18 11:36:45
复制代码 代码如下: <% dim oconn, ors, arows dim i,j set oconn=server.createobject("adodb.co...
复制代码 代码如下:

<%
dim oconn, ors, arows
dim i,j
set oconn=server.createobject("adodb.connection")
oconn.open "provider=microsoft.jet.oledb.4.0;data source=" & server.mappath("database/newasp.resx")
set ors=oconn.execute("select top 5 softid,softname from nc_softlist")
response.write "recordcount:" & ors.recordcount & "<br/>" '-1
arows=ors.getrows(-1) 'ors.eof=true,arows(col,row)
set ors=nothing
oconn.close()
set oconn=nothing

if isarray(arows) then
response.write "recordcount:" & ubound(arows,2)+1 & "<br/>"
for i=0 to ubound(arows,2)
for j=0 to ubound(arows,1)
response.write arows(j,i)
if j<> ubound(arows,1) then response.write ","
next
response.write "<br/>"
next
end if
%>