C
chengcheng178
Unregistered / Unconfirmed
GUEST, unregistred user!
用asp写的购物车的程序
rs是一个循环,rs5是一个循环
rs循环正常,rs5当加第一条记录时可以,(加入购物车),但加入第二条时 rs("cdname"就不能显示了,如果把第一条记录删除,第二条的记录可以显示,也就是只有一条记录才可以正常显示,请问这种循环的问题,应如何去写,请帮助,谢谢!
sub shoucang()
set rs=server.CreateObject("adodb.recordset"
dim rs5
set rs5=server.CreateObject("adodb.recordset"
rs.open "select xianhuo.*, shop_action.actionid,shop_action.bookid from xianhuo inner join shop_action on xianhuo.bookid=shop_action.bookid where shop_action.username='"&request.cookies("bookshop"("username"&"' and shop_action.zhuangtai=6",conn,1,1
if rs.eof And rs.bof then
Response.Write "
没有添加"
else
rs5.open "select * from cd_info where cdbianhao='"&rs("cdbianhao"&"'",conn,1,1
end if
'//html
response.write "<table width=96% border=0 align=center cellpadding=1 cellspacing=1 bgcolor=#FFFFFF>"
response.write "<tr><td width=7% bgcolor=#5F95D3><div align=center><font color=#FFFFFF>选 择</font></div></td>"
response.Write "<td width=45% bgcolor=#5F95D3><div align=center><font color=#FFFFFF>唱片编号</font></div></td>"
response.Write "<td width=45% bgcolor=#5F95D3><div align=center><font color=#FFFFFF>唱片名称</font></div></td>"
response.Write "<td width=14% bgcolor=#5F95D3><div align=center><font color=#FFFFFF>市场价</font></div></td>"
response.Write "<td width=13% bgcolor=#5F95D3><div align=center><font color=#FFFFFF>会员价</font></div></td>"
response.Write "<td width=12% bgcolor=#5F95D3><div align=center><font color=#FFFFFF>折 扣</font></div></td>"
response.Write "<td width=9% bgcolor=#5F95D3><div align=center><font color=#FFFFFF>删 除</font></div></td></tr>"
do while not rs.eof
response.write "<tr><td bgcolor=#EFF5FE><div align=center><input name=bookid type=checkbox checked value="&rs("cdbianhao"&"
></div></td>"
response.write "<td bgcolor=#EFF5FE STYLE='PADDING-LEFT: 5px'><div align=left>"&rs("cdbianhao"&"</div></td>"
do while not rs5.eof
response.write "<td bgcolor=#EFF5FE STYLE='PADDING-LEFT: 5px'><div align=left>"&rs5("cdname"&"</div></td>"
rs5.movenext
loop
response.write "<td bgcolor=#EFF5FE><div align=center>"&formatnumber(rs("youhuijia",2)&"元</div></td>"
response.write "<td bgcolor=#EFF5FE><div align=center><font color=#FF6600>"&formatnumber(rs("danjia",2)&"元</font></div></td>"
response.write "<td bgcolor=#EFF5FE><div align=center>"&formatnumber(rs("zhekou"*100,2)&"%</div></td>"
response.write "<td bgcolor=#EFF5FE><div align=center>"
response.Write "<img src=images/trash.gif width=15 height=17 border=0></a></div></td></tr>"
rs.movenext
loop
rs.close
set rs=nothing
response.write "</div></td></tr></form></table>"
end sub
rs是一个循环,rs5是一个循环
rs循环正常,rs5当加第一条记录时可以,(加入购物车),但加入第二条时 rs("cdname"就不能显示了,如果把第一条记录删除,第二条的记录可以显示,也就是只有一条记录才可以正常显示,请问这种循环的问题,应如何去写,请帮助,谢谢!
sub shoucang()
set rs=server.CreateObject("adodb.recordset"
dim rs5
set rs5=server.CreateObject("adodb.recordset"
rs.open "select xianhuo.*, shop_action.actionid,shop_action.bookid from xianhuo inner join shop_action on xianhuo.bookid=shop_action.bookid where shop_action.username='"&request.cookies("bookshop"("username"&"' and shop_action.zhuangtai=6",conn,1,1
if rs.eof And rs.bof then
Response.Write "
没有添加"
else
rs5.open "select * from cd_info where cdbianhao='"&rs("cdbianhao"&"'",conn,1,1
end if
'//html
response.write "<table width=96% border=0 align=center cellpadding=1 cellspacing=1 bgcolor=#FFFFFF>"
response.write "<tr><td width=7% bgcolor=#5F95D3><div align=center><font color=#FFFFFF>选 择</font></div></td>"
response.Write "<td width=45% bgcolor=#5F95D3><div align=center><font color=#FFFFFF>唱片编号</font></div></td>"
response.Write "<td width=45% bgcolor=#5F95D3><div align=center><font color=#FFFFFF>唱片名称</font></div></td>"
response.Write "<td width=14% bgcolor=#5F95D3><div align=center><font color=#FFFFFF>市场价</font></div></td>"
response.Write "<td width=13% bgcolor=#5F95D3><div align=center><font color=#FFFFFF>会员价</font></div></td>"
response.Write "<td width=12% bgcolor=#5F95D3><div align=center><font color=#FFFFFF>折 扣</font></div></td>"
response.Write "<td width=9% bgcolor=#5F95D3><div align=center><font color=#FFFFFF>删 除</font></div></td></tr>"
do while not rs.eof
response.write "<tr><td bgcolor=#EFF5FE><div align=center><input name=bookid type=checkbox checked value="&rs("cdbianhao"&"
></div></td>"
response.write "<td bgcolor=#EFF5FE STYLE='PADDING-LEFT: 5px'><div align=left>"&rs("cdbianhao"&"</div></td>"
do while not rs5.eof
response.write "<td bgcolor=#EFF5FE STYLE='PADDING-LEFT: 5px'><div align=left>"&rs5("cdname"&"</div></td>"
rs5.movenext
loop
response.write "<td bgcolor=#EFF5FE><div align=center>"&formatnumber(rs("youhuijia",2)&"元</div></td>"
response.write "<td bgcolor=#EFF5FE><div align=center><font color=#FF6600>"&formatnumber(rs("danjia",2)&"元</font></div></td>"
response.write "<td bgcolor=#EFF5FE><div align=center>"&formatnumber(rs("zhekou"*100,2)&"%</div></td>"
response.write "<td bgcolor=#EFF5FE><div align=center>"
response.Write "<img src=images/trash.gif width=15 height=17 border=0></a></div></td></tr>"
rs.movenext
loop
rs.close
set rs=nothing
response.write "</div></td></tr></form></table>"
end sub