ASP对oracle8数据库中的记录集如何得到记录的总数?高分酬谢

zhangxhsj 2002-10-10 10:28:59
sqlstring="select * from table"
set rs=conn.open(sqlstring)

totalrec=rs.recordcount

可为什么得到的是-1,该如何控制打开呢。我实验了很多游标方式都不行!

请指教!高分酬谢!
...全文
102 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
iStringTheory 2002-10-20
  • 打赏
  • 举报
回复
把你的打开数据库的代码按如下修改即可

conn.open connstr
conn.CursorLocation=3 ''<-关键
zhangxhsj 2002-10-20
  • 打赏
  • 举报
回复
看来,只有用select count(*) 来实现了,
其他的好象多不行。
beauty_beast 2002-10-19
  • 打赏
  • 举报
回复
两种方法
1 数据库
<%
strsql="select count(*) reccount from yourtable"
set oconn=server.createobject("adodb.connection")
set ocmd=server.createobject("adodb.command")
set orec=server.createobject("adodb.recordset")
oconn.open yourdbsconn
ocmd.activeconnection=oconn
ocmd.commandtext=strsql
set orec=ocmd.execute
drecount=cdbl(orec("reccount"))
%>
2记录集循环
<%
strsql="select from yourtable"
set oconn=server.createobject("adodb.connection")
set ocmd=server.createobject("adodb.command")
set orec=server.createobject("adodb.recordset")
oconn.open yourdbsconn
ocmd.activeconnection=oconn
ocmd.commandtext=strsql
set orec=ocmd.execute
dcount=0
while not orec.eof
dcount=dcount+1
orec.movenext
wend
itotalcount=dcount
%>


zy790816 2002-10-18
  • 打赏
  • 举报
回复
用rs.open"select count(*)mycount from table"
rs("mycount")为记录总数
zy790816 2002-10-18
  • 打赏
  • 举报
回复
用rs.open"select count(*)mycount from table"
rs("mycount")为记录总数
palmkey 2002-10-10
  • 打赏
  • 举报
回复
set rs=conn.execute(sqlstring,C,adcmdexe) 'C为记录数
response.write C
zhangxhsj 2002-10-10
  • 打赏
  • 举报
回复
各位在oracle环境下测试了吗?

我需要测试过的正确的回答。
张九天 2002-10-10
  • 打赏
  • 举报
回复
Set myconn=Server.CreateObject("ADODB.Connection")
Set rs=Server.CreateObject("ADODB.Recordset")
myconn.open"连接数据库语句"
sqlstring="select * from table"
rs.open sqlstring,myconn
totalrec=rs.recordcount
response.write totalrec
zhangxhsj 2002-10-10
  • 打赏
  • 举报
回复
仍然不能得到!
veryhappy 2002-10-10
  • 打赏
  • 举报
回复
set rs = server.createobject("adodb.recordset")
rs.open sqlstring,conn,1,3
resposne.write sr.recordcount
zhangxhsj 2002-10-10
  • 打赏
  • 举报
回复
这样也不行!

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧