str="select count(*) from tablename" 语句:怎么使变量得到count(*)值?

zyxwh 2003-05-08 04:47:45
str="select count(*) from tablename" 语句:怎么使变量得到count(*)值?
在ACCESS数据库中不能建存储过程吧,
我试着用select @pcount=count(*) from tablename
rst(@pcount)不行,提示错误。
用rst.recordcount 要用动态游标,比较浪费资源。
...全文
42 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
zyxwh 2003-05-08
  • 打赏
  • 举报
回复
刚才试了一下,
1、str="select count(*) as cnt from tablename"
rs("cnt")可用,

2、total=rs(0)也显示数值,但与实际不符,实际是16,它显示3

3、select str=count(*) from tablename 不能使用,指示参数不足
yangyanli 2003-05-08
  • 打赏
  • 举报
回复
str="select count(*) as cnt from tablename"
rs("cnt")

这个方法我用过。
shaoyan 2003-05-08
  • 打赏
  • 举报
回复
select str=count(*) from tablename
cqfeng 2003-05-08
  • 打赏
  • 举报
回复
str="select count(*) as cnt from tablename"
rs("cnt")
popcode 2003-05-08
  • 打赏
  • 举报
回复
total=rs(0)

28,391

社区成员

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

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