| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 611 人关注过本帖
标题:d我的网店作业,在添加订单详情时给弄成死循环了、
只看楼主 加入收藏
liangfengfen
Rank: 2
等 级:论坛游民
帖 子:50
专家分:10
注 册:2010-8-22
结帖率:87.5%
收藏
 问题点数:0 回复次数:2 
d我的网店作业,在添加订单详情时给弄成死循环了、
<%
   
   dim sqlcar,rscar,uid,OsumM,uname,oname,oaddr,opcode,oTel,oemail,ocoment,oCount,orderCode,i,sql1,rs1,sql,rs,pcode,pcount
   
    uname=Request.form("c_name")
    oname=Request.Form("o_name")
    oaddr=Request.Form("o_addr")
    opcode=Request.Form("o_pcode")
    oTel=Request.Form("o_phone")
    oemail=Request.Form("o_email")
    ocoment=Request.Form("o_coment")
      '=======================================================
    '得到购物单编号
    sql1="select count(*) as Ocount from t_order where order_time>date()"
    Set rs1=datasource.GetRecordSet(sql1)
    oCount=rs1("Ocount")+1
   
    if oCount<10 then
      orderCode=year(date)&"-"&month(date)&"-"&day(date)&"-"&"000"&oCount
    elseif oCount<100 then
      orderCode=year(date)&"-"&month(date)&"-"&day(date)&"-"&"00"&oCount
    elseif oCount<1000 then
      orderCode=year(date)&"-"&month(date)&"-"&day(date)&"-"&"0"&oCount
    end if
   
    '====================================================
    '获取购买货物的总数,商品编号、数量,添加购物单详情
      OsumM=0
      uid=GetCustomerID()
      sqlcar="select* from t_shopcar ts inner join t_goods tg on ts.p_code=tg.goods_id where c_code="& uid
      Set rscar =datasource.GetRecordSet(sqlcar)
      pcode=rscar("goods_code")
      pcount=rscar("p_count")
      
    While not rscar.Eof
       rscar.MoveFirst
         OsumM=OsumM+(rscar("promote_price")* rscar("p_count"))
         sql="INSERT INTO[t_order_list]([order_code],[goods_code],[goods_number])VALUES('"& orderCode &"','"& pcode &"','"&pcount &"')"   
        datasource.ExecuteCommand(sql)
        rscar.MoveNext
    wend
    '==========================================
    '添加购物单
       sql="INSERT INTO t_order([order_code] ,[customer] ,[order_time] ,[total_money] ,[r_name],[r_addr] ,[r_postcode] ,[r_tel] ,[r_eml],[m_ocomment]) VALUES('"& orderCode &"','"& uname &"',now,'"& OsumM &"','"& oname &"','"& oaddr &"','"& opcode &"','"& oTel &"','"& oemail &"','"& ocoment &"')"
    datasource.ExecuteCommand(sql)
    set datasource = nothing

    '=============================================
    '添加订单详情
'     rscar.MoveFirst
'    while not rscar.Eof
'        sql="INSERT INTO[t_order_list]([order_code],[goods_code],[goods_number])VALUES('"& orderCode &"','"& pcode &"','"&pcount &"')"   
'       datasource.ExecuteCommand(sql)
'      
'       rscar.MoveNext
'    wend
'   
    Response.Redirect("index.asp")
%>
红色的部分写成死循环了,同学的 都可以运行,我的就死了。请高手看看啊,帮帮小弟啊。  3QU

[ 本帖最后由 liangfengfen 于 2010-8-30 20:02 编辑 ]
搜索更多相关主题的帖子: count 网店 
2010-08-30 18:33
wangjy500
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:贵宾
威 望:13
帖 子:457
专家分:2569
注 册:2010-7-11
收藏
得分:0 
While not rscar.Eof
      
         OsumM=OsumM+(rscar("promote_price")* rscar("p_count"))
         sql="INSERT INTO[t_order_list]([order_code],[goods_code],[goods_number])VALUES('"& orderCode &"','"& pcode &"','"&pcount &"')"   
        datasource.ExecuteCommand(sql)
        rscar.MoveNext
    wend
rscar.MoveFirst这句不要,你每次都先移动到第一条,当然永远不到到最后一条了!

QQ:63572063
2010-08-30 23:00
liangfengfen
Rank: 2
等 级:论坛游民
帖 子:50
专家分:10
注 册:2010-8-22
收藏
得分:0 
回复 2楼 wangjy500
             3qu
2010-08-30 23:03
快速回复:d我的网店作业,在添加订单详情时给弄成死循环了、
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.011576 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved