参数传递后,保存的文件代码
<%
id=request("id")
n=request("n")
'response.Write(n)
set rs=server.CreateObject("adodb.recordset")
set rs1=server.CreateObject("adodb.recordset")
set rs2=server.CreateObject("adodb.recordset")
sql="update adaffirminfo set md='"&trim(request("md"))&"',kh='"&trim(request("kh"))&"',contract='"&trim(request("contract"))&"',season='"&trim(request("season"))&"',date='"&trim(request("date"))&"',factory='"&trim(request("factory")&"',place='"&trim(request("place"))&"',cf='"&trim(request("cf"))&"',remark='"&trim(request("remark"))&"',other='"&trim(request("other"))&"',name='"&trim(request("names"))&"' where affirm_code='"&request("id"))&"'"
rs.open sql,cn,3
for i=1 to n
kkh=trim(request("kkh"&i))
skh=trim(request("skh"&i))
color=trim(request("color"&i))
sizes=trim(request("sizes"&i))
ph=trim(request("ph"&i))
'response.Write(ph)
total=trim(request("total"&i))
if total="" then
total=0
end if
unit=trim(request("select"&i))
price=trim(request("price"&i))
if price="" then
price=0
end if
money=trim(request("money"&i))
if money="" then
money=0
end if
inv=trim(request("inv"&i))
sql1="update adaffirm set kkh='"&kkh&"',skh='"&skh&"',ph='"&ph&"',color='"&color&"',sizes='"&sizes&"',total='"&total&"',unit='"&unit&"',price='"&price&"',money='"&money&"',inv_no='"&inv&"' where affirm_code='"&id&"' and id='"&i&"'"
'response.Write(sql1&"<br>"&"<br>"&"<br>"&"<br>")
'i=i+1
rs1.open sql1,cn,3
next
m=request("m")
k=int(m)+int(n)
for j=n+1 to k-1
kkh=trim(request("kkh"&j))
skh=trim(request("skh"&j))
total=trim(request("total"&j))
unit=trim(request("select"&j))
price=trim(request("price"&j))
inv=trim(request("inv"&j))
ph=trim(request("ph"&j))
response.Write(ph)
remark=trim(request("bz"&j))
money=trim(request("money"&j))
color=trim(request("color"&j))
sizes=trim(request("sizes"&j))
if total="" then
total=0
end if
if price="" then
price=0
end if
if money="" then
money=0
end if
sql1="insert into adaffirm (affirm_code,id,kkh,skh,total,unit,price,inv_no,money,color,sizes,ph) values ('"&id&"','"&j&"','"&kkh&"','"&skh&"','"&total&"','"&unit&"','"&price&"','"&inv&"','"&money&"','"&color&"','"&sizes&"','"&ph&"')"
'response.Write(sql1&"<br>")
rs2.open sql1,cn,3
next
%>
下面是我用循环实现的添加行以及修改的功能
<%
id=request("id")
set rs=server.CreateObject("adodb.recordset")
set rs1=server.CreateObject("adodb.recordset")
sql="select * from adaffirminfo where affirm_code='"&id&"'"
sql1="select * from adaffirm where affirm_code='"&id&"' order by id"
rs.open sql,cn,1
rs1.open sql1,cn,1
a=0
b=0
%>
<body>
<%if not rs.eof and not rs1.eof then %>
<table width="700">