asp 查询数据库 acess
工作遇到一个asp的页面修改。我想实现先根据vipid查询vipvid,vipid是已知条件,然后再根据vipvid查询其他信息。为啥下面一直报错。。求解。。。木有学过a...
工作遇到一个asp的页面修改。我想实现先根据vipid查询vipvid ,vipid 是已知条件,然后再根据vipvid 查询 其他信息。为啥下面一直报错。。求解。。。木有学过asp。只看了一些简单的语句。。。求解答
程序代码如下:
dim vtime,qj,fj,vipvid
set rs1=conn.execute("select vipvid from kingmember where vipid='"&vipid&"'")
if not rs1.eof and not rs1.bof then
vipvid=rs1("vipvid")
else
vipvid=0
end if
set rs=conn.execute("select bmvst from kinghdbm_vip where vpass=5 and vipvid='"&vipvid&"'")
if not rs.eof and not rs.bof then
vtime=conn.execute("select sum(bmvst) from kinghdbm_vip where vipvid='"&vipvid&"'")(0)
else
vtime=0
end if
qj=conn.execute("select count(vipvid) from kinghdbm_vip where vpass=3 and vipvid='"&vipvid&"'")(0)
fj=conn.execute("select count(vipvid) from kinghdbm_vip where vpass=4 and vipvid='"&vipvid&"'")(0)
if len(qj)=0 then qj=0
if len(fj)=0 then fj=0
conn.execute "update kingmember set vipss=vipst+"&vtime&",vipqj="&qj&",vipfj="&fj&" where vipid="&vipid&";" 展开
程序代码如下:
dim vtime,qj,fj,vipvid
set rs1=conn.execute("select vipvid from kingmember where vipid='"&vipid&"'")
if not rs1.eof and not rs1.bof then
vipvid=rs1("vipvid")
else
vipvid=0
end if
set rs=conn.execute("select bmvst from kinghdbm_vip where vpass=5 and vipvid='"&vipvid&"'")
if not rs.eof and not rs.bof then
vtime=conn.execute("select sum(bmvst) from kinghdbm_vip where vipvid='"&vipvid&"'")(0)
else
vtime=0
end if
qj=conn.execute("select count(vipvid) from kinghdbm_vip where vpass=3 and vipvid='"&vipvid&"'")(0)
fj=conn.execute("select count(vipvid) from kinghdbm_vip where vpass=4 and vipvid='"&vipvid&"'")(0)
if len(qj)=0 then qj=0
if len(fj)=0 then fj=0
conn.execute "update kingmember set vipss=vipst+"&vtime&",vipqj="&qj&",vipfj="&fj&" where vipid="&vipid&";" 展开
1个回答
展开全部
数据库中的vipvid字段属性是字符型的还是整型?如果是整型的话,修改下面的语句
select bmvst from kinghdbm_vip where vpass=5 and vipvid='"&vipvid&"'"
为
"select bmvst from kinghdbm_vip where vpass=5 and vipvid="&vipvid
select bmvst from kinghdbm_vip where vpass=5 and vipvid='"&vipvid&"'"
为
"select bmvst from kinghdbm_vip where vpass=5 and vipvid="&vipvid
更多追问追答
追问
vipvid 是字符的。。。
set rs1=conn.execute("select vipvid from kingmember where vipid='"&vipid&"'")
if not rs1.eof and not rs1.bof then
vipvid=rs1("vipvid")
else
vipvid=0
end if
我觉得是这段代码有问题。。。去掉这段代码就不报错了
追答
set rs1=conn.execute("select vipvid from kingmember where vipid='"&vipid&"'")
if rs1.eof and rs1.bof then
vipvid=0
else
vipvid=rs1("vipvid")
end if
这样试试
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询