宝泰里通是不是吗丁啉:ASP 关于if rs的问题 在线等

来源:百度文库 编辑:高考问答 时间:2024/04/20 19:57:02
先看代码

<%dim bookid,action,i
action=request("action")
set rs=server.CreateObject("adodb.recordset")
rs.open "select count(*) as rec_count from BJX_action where username='"&username&"' and zhuangtai=7",conn,1,1
if rs("rec_count")=0 then
response.write "<script language=javascript>alert('对不起,您购物车没有商品,请在购物后,再去“结算中心”!');window.close();</script>"
response.End
end if
rs.close
set rs=nothing
//////////////////////////////////
select case action
case ""
set rs=server.CreateObject("adodb.recordset")
rs.open "select bjx_action.actionid,bjx_action.bookid,bjx_action.bookcount,bjx_action.zonger,BJX_goods.bookname,bjx_action.shjiaid,BJX_goods.shichangjia,BJX_goods.huiyuanjia,BJX_goods.vipjia from BJX_goods inner join bjx_action on BJX_goods.bookid=bjx_action.bookid where bjx_action.username='"&username&"' and bjx_action.zhuangtai=7",conn,1,1
%>

我要实现在

if rs("rec_count")=0 then
response.write "<script language=javascript>alert('对不起,您购物车没有商品,请在购物后,再去“结算中心”!');window.close();</script>"
response.End
end if

之后能再检查rec_count的值>=2的代码。

我试过

if rs("rec_count")=0 then
response.write "<script language=javascript>alert('对不起,您购物车没有商品,请在购物后,再去“结算中心”!');window.close();</script>"
response.End
else
if rs("rec_count")>=2 then
response.write "<script language=javascript>alert('对不起,您购物车没有商品,请在购物后,再去“结算中心”!');window.close();</script>"
response.End
end if
rs.close

但是不对。500错误。

不明白了。