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 编辑 ]