网站就差这一步了

seeme1014 2004-01-11 11:32:19
<%
user_name=session("user_name")
sql="select * from basket where user_name='"&user_name&"' and basket_check=false "
rs.open sql,conn,3,3
if rs.eof then
response.write "You haven't ordered anything"
else
do while not rs.eof
%>
<tr>
<td width="195" height="25"><div align="center"><font color=red><%=rs("hw_name")%></font></div></td>
<td width="60" height="25"><div align="center"><%=rs("hw_cash")%><font face="Arial, Helvetica, sans-serif">Dollar</font></div></td>
<td width="60" height="25"><div align="center"><%=rs("basket_count")%></div></td>
<td width="80" height="25"><div align="center"><%=rs("hw_cash")*rs("basket_count")%><font face="Arial, Helvetica, sans-serif">Dollar</font></div></td>
</tr>
<%totalcash=totalcash+(rs("hw_cash")*rs("basket_count"))%>
<%rs.movenext
loop
end if
rs.close
%>
<%
username=session("user_name")
sql="select [basket.hw_cash],[basket.basket_count],[hw.hw_id] from basket,hw where basket.hw_id=hw.hw_id and hw.sort_id=46 and basket.user_name='"&username&"'and basket.basket_check=false "
106 rs.open sql,conn,3,3
if rs.eof then
pifa=0
else
do while not rs.eof
pifa=pifa+(rs("basket.hw_cash")*rs("basket.basket_count"))
rs.movenext
loop
rs.close
%>

<tr>
<td height="25"><div align="center"><b class="dz1">Total:<font color=red>
<% if totalcash-pifa<5000 then
response.write "<script language=JavaScript>{window.alert('please make sure your total prices more than $5000 expect wholesale goods');window.location.href='clear.asp';}</script>"
response.end
%>
<%else%>
<%=totalcash%>
<%end if%>
我想在总价中扣除批发商品的总价,可是一直报错,我检查过了basket表和hw表的字段名

错误类型:
Microsoft JET Database Engine (0x80004005)
/cash.asp, 第 106 行


浏览器类型:
Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)

页:
GET /cash.asp

时间:
2004年1月11日, 10:01:03


详细信息:
Microsoft 支持
...全文
54 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
seeme1014 2004-01-11
  • 打赏
  • 举报
回复
select [basket.hw_cash],[basket.basket_count],[hw.hw_id] from basket,hw where basket.hw_id=hw.hw_id and hw.sort_id=46 and basket.user_name='elvaliang' and basket.basket_check=false Total: 12900 Dollar
seeme1014 2004-01-11
  • 打赏
  • 举报
回复
字段名没错,那我可以把字段名用*号全取出来吗?
aoeiuvcom 2004-01-11
  • 打赏
  • 举报
回复
把SQL的输出内容发出来

还有,字段名字你确认都没写错?
seeme1014 2004-01-11
  • 打赏
  • 举报
回复
我上午试过了新加一个recordset对象,也是执行那里出错了
seeme1014 2004-01-11
  • 打赏
  • 举报
回复
试过了,还在那里出错
seeme1014 2004-01-11
  • 打赏
  • 举报
回复
<%
username=session("user_name")
sql="select [basket.hw_cash],[basket.basket_count],[hw.hw_id] from basket,hw where basket.hw_id=hw.hw_id and hw.sort_id=46 and basket.user_name='"&username&"'and basket.basket_check=false "
rs.open sql,conn,3,3
^执行到这里出错了,我加了空格,加了response.write(sql),好像没错
if rs.eof then
pifa=0
else
do while not rs.eof
pifa=pifa+(rs("basket.hw_cash")*rs("basket.basket_count"))
rs.movenext
loop
rs.close
%>
aoeiuvcom 2004-01-11
  • 打赏
  • 举报
回复
输出当然不会有错了,就算有错也是上一行的变量名字问题

但这sql不一定是对的

先加上少掉的空格试试
seeme1014 2004-01-11
  • 打赏
  • 举报
回复
输出sql语句好像没错的,然后一执行rs.open sql,conn,3,3就错
changechange 2004-01-11
  • 打赏
  • 举报
回复
太长了,请贴出有关得那些,并且标明行号
aoeiuvcom 2004-01-11
  • 打赏
  • 举报
回复
如果说有错,那么

basket.user_name='"&username&"'and basket.basket_check=false "
^(这里似乎少了个空格)


seeme1014 2004-01-11
  • 打赏
  • 举报
回复
106就是我在上面标出来的那一行,sql语句有错吗?
aoeiuvcom 2004-01-11
  • 打赏
  • 举报
回复
有一个办法可以检查错误:)

把出错的SQL语句输出来

然后用数据库本身的功能进行执行,

这样,出错信息就是你想要的了:)
aoeiuvcom 2004-01-11
  • 打赏
  • 举报
回复
不好意思,看花眼了:(
aoeiuvcom 2004-01-11
  • 打赏
  • 举报
回复
106行???

哪行是呀!

28,407

社区成员

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

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