保存的时候会保存两次
<%
outh=cint(request("outh"))
customer=request("customer")
area=request("area")
if request("quoteno")="" then
connstrdan="Driver={SQL Server};server=symserver;database=dan2003;uid=lxy;pwd=82910555623"
Set conndan = Server.CreateObject("ADODB.Connection")
conndan.Open connstrdan
Set rs_goods= Server.CreateObject("ADODB.RecordSet")
sql1="exec quoteorderno @a="&area
Rs_goods.open sql1,conndan
quoteno=rs_goods("orderno")
else
quoteno=request("quoteno")
end if
bjbb=request("bjbb")
linkman=request("linkman")
khaddress=request("khaddress")
quotedate=request("quotedate")
khtel=request("khtel")
khfax=request("khfax")
tax=request("tax")
tote=request("tote")
remark=request("remark")
payment=request("payment")
deliverytime=request("deliverytime")
deliveryaddress=request("deliveryaddress")
usetime=request("usetime")
director=request("director")
operation=request("operation")
connstr="Driver={SQL Server};server=symserver;database=dan2003;uid=lxy;pwd=82910555623"
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open connstr
sql="Select * From quote Where quoteno='"& quoteno & "'"
Set rs=conn.Execute(sql)
If Not rs.EOF Then
Response.Write "<script language='javascript'>"
Response.Write "alert('报价单号重复!');"
Response.Write "window.history.go(-1);"
Response.Write "</script> "
Response.End
End If
Set rs=Server.CreateObject("ADODB.Recordset")
sql="Select * From quote"
rs.Open sql,connstr,1,3
rs.AddNew
rs("customer")=customer
rs("area")=area
rs("bjbb")=bjbb
rs("linkman")=linkman
rs("quoteno")=quoteno
rs("khaddress")=khaddress
rs("quotedate")=quotedate
rs("khtel")=khtel
rs("khfax")=khfax
rs("tax")=tax
rs("tote")=tote
rs("remark")=remark
rs("payment")=payment
rs("deliverytime")=deliverytime
rs("deliveryaddress")=deliveryaddress
rs("usetime")=usetime
rs("director")=director
rs("operation")=operation
rs("updatetime")=now()
rs("del1")=0
rs.Update
rs.Close
Set rs=Server.CreateObject("ADODB.Recordset")
sql="Select * From quotedetail"
rs.Open sql,connstr,1,3
if outh<>"" then
rsh=outh-1
end if
for i=0 to rsh
if isempty(request("code1"&i)) then
code1=""
else
code1=request("code1"&i)
end if
if isempty(request("name1"&i)) or request("name1"&i)="" then
name1=""
else
name1=request("name1"&i)
end if
if isempty(request("units"&i)) or request("units"&i)="" then
units=""
else
units=request("units"&i)
end if
if isempty(request("num1"&i)) or request("num1"&i)="" then
num1=""
else
num1=request("num1"&i)
end if
if isempty(request("price"&i)) or request("price"&i)="" then
price=""
else
price=request("price"&i)
end if
if isempty(request("total"&i)) or request("total"&i)="" then
total=""
else
total=request("total"&i)
end if
if isempty(request("quoteprice"&i)) or request("quoteprice"&i)="" then
quoteprice=""
else
quoteprice=request("quoteprice"&i)
end if
if isempty(request("abate"&i)) or request("abate"&i)="" then
abate=""
else
abate=request("abate"&i)
end if
if code1="" then
exit for
end if
rs.AddNew
rs("quoteno")=quoteno
rs("code1")=code1
rs("name1")=name1
rs("units")=units
rs("num1")=num1
rs("price")=price
rs("total")=total
rs("quoteprice")=quoteprice
rs("abate")=abate
rs.Update
next
rs.Close
Response.Write "<script language='javascript'>"
Response.Write "alert('保存成功!');"
Response.Write "window.location.href='quote.asp';"
Response.Write "</script> "
%>
请问哪里出错了,保存的时候会保存两个内容一摸一样,单号相差一的数据?
[解决办法]
1、用程序开发软件跟踪一下。
2、格式化一下你的代码,看看if/else是否有不对应的地方。
3、你这个应该是逻辑不够严密。而且不应该发到sql版。
[解决办法]
代码跟踪调试一下,看看为什么是两次就ok了。
[解决办法]
设个断点,单步跟踪下你的代码,这个问题应该比较好查找。