|
在做订单生成时遇到下列问题:运行订单程序,生成一订单号,如11,再次运行,依旧是此订单号.纳闷!!........查看数据库中的订单表orderlist,发现订单号form_id并不只是11;查看商品列表shoplist表,发现其中的form_id全是11.下面是代码,各位兄弟姐妹帮忙看下吧, <%Id=Session("admin") set Rs = Server.CreateObject("ADODB.recordset") sql="select * from yonghuxinxi where admin='"&Id&"'" rs.open sql,conn,1,1 ProductList = Session("ProductList") flags="尚未处理" If Len(ProductList) = 0 Then Response.Redirect "nothing.asp" end if
'保存购买人信息 set rs=server.createobject("adodb.recordset") sqltext="select * from orderlist" rs.open sqltext,conn,3,3,1
'添加一个用户到数据库 rs.addnew rs("userid")=request.form("admin") rs("tName")=request.form("tName") rs("Zip")=request.form("Zip") rs("tel")=request.form("tel") rs("E-mail")=request.form("E-mail") rs("Address")=request.form("Address") rs("Pay")=request.form("Pay") rs("Flag")=flags rs("Remark")=request.form("Remark") If rs("Remark")="" then rs("Remark")="无" End If rs.update rs.close sql="select Form_Id from OrderList order by regtime desc" rs.open sql,conn,3,3,1 c=rs(0) rs.close
products=split(request("spbh"),",") for i=0 to UBound(Products) next set rs=server.createobject("adodb.recordset") session("productlist")=productlist sql = "Select * From Product" sql = sql & " Where Product_Id In (" & ProductList & ")" sql = sql & " Order By Product_No" Set rs = conn.Execute( sql )
if session(rs("Product_Id"))=0 then session(rs("Product_Id"))=1 end if
while not rs.eof set rs2=server.createobject("adodb.recordset") sqltext2="select * from shoplist" rs2.open sqltext2,conn,3,3,1 rs2.addnew rs2("Id")=rs("Product_Id") rs2("Form_Id")=c rs2("Product_Name")=rs("Product_Name") rs2("Number")=cint(session(rs("Product_Id"))) rs2("Product_nPrice")=ccur(rs("Product_nPrice")) rs2.update%>
<% rs2.close rs.movenext wend session.abandon 'response.redirect"success.asp" rs.close conn.close %> |
|