学校作业,有没有大佬看下问题出在哪?

xianyu_zhou 2019-12-11 12:46:57

orders3.asp:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Connections/conn.asp" -->
<% dim name1,total,email,province,city,address,zip,phone
name1=request("name1")
total=request("total")
email=request("email")
province=request("province")
city=request("city")
address=request("address")
zip=request("zip")
phone=request("phone")
set conn=server.CreateObject("adodb.connection")
conn.open MM_conn_STRING
set rsorder=server.CreateObject("adodb.recordset")
sql="select * from Orders"
rsorder.open sql,conn,3,2
rsorder.addnew
rsorder("Odate")=date
rsorder("Total")=total
rsorder("CName")=name1
rsorder("Email")=email
rsorder("Province")=province
rsorder("City")=city
rsorder("Address")=address
rsorder("Zip")=zip
rsorder("Phone")=phone
rsorder.update
rsorder.movelast
OrderID=rsorder("OrderID")
rsorder.close
CartID=session("CartID")
if CartID="" then CartID=0
set rsitem=server.CreateObject("adodb.recordset")
sql="select * from CartsItems where CartID="&CartID
rsitem.open sql,conn,0,1
while not rsitem.eof
sql="insert into OrderItems(OrderID,ProductID,PName,Price,Quantity)values("& OrderID &","& rsitem("ProductID") &", '"& rsitem("Name1") &"',"& rsitem("Price") &","& rsitem("Quantity") &")"
conn.execute sql
rsitem.movenext
wend
rsitem.close
set conn=nothing
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>订单生成</title>
</head>

<body>
<font color="#000000" size="4" face="华文宋体">感谢惠顾!您的订单号是:<%=OrderID%><br />
请记住您的订单号,以便必要时查询。<br />
请单击<a href="orders4.asp">这里</a>返回。</font>
</body>
</html>


为什么Orders数据表里没有数据啊?只有一个日期。


相关页面代码如下:
orders2.asp:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Connections/conn.asp" -->
<%
Dim rs__MMColParam
rs__MMColParam = "1"
If (Session("CartID") <> "") Then
rs__MMColParam = Session("CartID")
End If
%>
<%
Dim rs
Dim rs_cmd
Dim rs_numRows

Set rs_cmd = Server.CreateObject ("ADODB.Command")
rs_cmd.ActiveConnection = MM_conn_STRING
rs_cmd.CommandText = "SELECT * FROM CartsItems WHERE CartID = ?"
rs_cmd.Prepared = true
rs_cmd.Parameters.Append rs_cmd.CreateParameter("param1", 5, 1, -1, rs__MMColParam) ' adDouble

Set rs = rs_cmd.Execute
rs_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = -1
Repeat1__index = 0
rs_numRows = rs_numRows + Repeat1__numRows
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>确认订单</title>
<style type="text/css">
p {
font-weight: bold;
text-align: center;
}
td {
font-size: 18px;
line-height: 24px;
color: #15007b;
font-weight: bold;
}
</style></head>

<body>
<form id="form1" name="form1" method="post" action="orders3.asp">
<p><font color="#800080" size="5" face="华文宋体">您的订单如下</font></p>
<table width="75%" border="1" align="center">
<tr>
<td width="40" align="center" bgcolor="#cccccc">序号</td>
<td align="center" bgcolor="#cccccc">商品名称</td>
<td align="center" bgcolor="#cccccc">单价</td>
<td align="center" bgcolor="#cccccc">数量</td>
<td align="center" bgcolor="#cccccc">金额</td>
</tr>
<% i=1
total=0
While ((Repeat1__numRows <> 0) AND (NOT rs.EOF))
sum=rs("Price")*rs("Quantity")
%><tr>
<td align="center"><%=formatnumber(i,0)%> </td>
<td align="center"><%=(rs.Fields.Item("Name1").Value)%></td>
<td align="center"><%=formatcurrency(rs.Fields.Item("Price").Value,2)%></td>
<td align="center"><%=(rs.Fields.Item("Quantity").Value)%></td>
<td align="center"><%=formatcurrency(sum,2)%> </td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rs.MoveNext()
i=i+1
total=total+sum
Wend
%>
<tr>
<td colspan="4" align="center" bgcolor="#e4e4e4">总计</td>
<td align="center" bgcolor="#e4e4e4"><%=formatcurrency(total,2)%> </td>
</tr>
</table>
<p> </p>
<table width="75%" border="0" cellpadding="0" cellspacing="0" align="center" >
<tr>
<td align="center" bgcolor="#cccccc">您的送货信息</td>
</tr>
</table>
<table width="75%" border="0" cellpadding="0" cellspacing="0" align="center" >
<tr>
<td width="40%" height="180" align="right" bgcolor="#cccccc">
<%
dim name1,email,province,city,address,zip,phone
name1=request("name1")
email=request("email")
province=request("province")
city=request("city")
address=request("address")
zip=request("zip")
phone=request("phone")
if name1=empty or email=empty or province=empty or city=empty or address=empty or zip=empty or phone=empty then
response.Write"请完善订单信息!<br>请单击<a href='orders1.asp'>这里</a>返回填写。"
response.End
end if
%>
</td>
<td width="60%" height="180" bgcolor="#cccccc"><%
response.Write"真实姓名:"&name1&"<br>"
response.Write"电子邮件:"&email&"<br>"
response.Write"所在省份:"&province&"<br>"
response.Write"所在城市:"&city&"<br>"
response.Write"详细地址:"&address&"<br>"
response.Write"邮政编码:"&zip&"<br>"
response.Write"联系电话:"&phone&"<br>"
%></td>
</tr>
</table>
<p>
<input type="submit" name="button" id="button" value="确认订购" />
    
<a href="orders4.asp"> <input type="button" name="button2" id="button2" value="取消订购" /></a>
</p>
<p> </p>
<p> </p>
</form>
<!--#include file="foot.inc"-->
</body>
</html>
<%
rs.Close()
Set rs = Nothing
%>

orders1.asp:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Connections/conn.asp" -->
<%
CartID=session("CartID")
if CartID="" then CartID=0
set conn=server.CreateObject("adodb.connection")
conn.open MM_conn_STRING
set rsitem=server.CreateObject("adodb.recordset")
sql="select * from CartsItems where CartID="&CartID
rsitem.open sql,conn,0,1
if rsitem.eof then
rsitem.close
set conn=nothing%>
<hr><center>对不起,您还没有购买任何商品,不能结账。<br>
请单击<a href="products.asp">这里</a>继续购物。</center>
<%
response.End
end if
rsitem.close
set conn=nothing
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>填写送货信息</title>
<style type="text/css">
p {
text-align: center;
}
</style>
</head>

<body bgcolor="#bbddff">
<p><strong><em><font color="#800080" size="3" face="华文行楷">感谢您在网络商城购物!</font></em></strong></p>
<p><strong><font color="#000080" size="3" face="华文楷体">为了确保您的商品能够及时送达,请准确填写以下内容。</font></strong></p>
<form id="form1" name="form1" method="post" action="orders2.asp">
<table width="70%" border="1" align="center">
<tr>
<td width="22%" height="30" align="right">真实姓名:</td>
<td width="78%" align="left"><input name="name1" type="text" id="textfield" size="20" />
<font color="#FF0000">**</font></td>
</tr>
<tr>
<td width="22%" height="30" align="right">电子邮件:</td>
<td width="78%" align="left"><input name="email" type="text" id="textfield2" size="29" />
<font color="#FF0000">**</font></td>
</tr>
<tr>
<td width="22%" height="30" align="right">所在省份:</td>
<td width="78%" align="left"><input name="province" type="text" id="textfield3" size="20" />
<font color="#FF0000">**</font></td>
</tr>
<tr>
<td width="22%" height="30" align="right">所在城市:</td>
<td width="78%" align="left"><input name="city" type="text" id="textfield4" size="20" />
<font color="#FF0000">**</font></td>
</tr>
<tr>
<td width="22%" height="30" align="right">详细地址:</td>
<td width="78%" align="left"><input name="address" type="text" id="textfield5" size="43" />
<font color="#FF0000">**</font></td>
</tr>
<tr>
<td width="22%" height="30" align="right">邮政编码:</td>
<td width="78%" align="left"><input name="zip" type="text" id="textfield6" size="12" />
<font color="#FF0000">**</font></td>
</tr>
<tr>
<td width="22%" height="30" align="right">联系电话:</td>
<td width="78%" align="left"><input name="phone" type="text" id="textfield7" size="20" />
<font color="#FF0000">** </font></td>
</tr>
</table>
<p>
<input type="submit" name="button" id="button" value="提交" />
    
<input type="reset" name="button2" id="button2" value="全部重填" />
</p>
<p>(注:有<font color="#FF0000">**</font>标记的项目必须填写!)</p>
</form>
</body>
</html>

...全文
37 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

1,502

社区成员

发帖
与我相关
我的任务
社区描述
VB 网络编程
社区管理员
  • 网络编程
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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