多步 OLE DB 操作产生错误,急急!
代码如下:
<!--#include file="conn.asp" -->
<% if session.contents("jiben_right")="1" then %>
<% dim need,supplier,supplier_name,postion,pay_out,qixian,rs,strsql,rec,sql,ht_date,input_name
dim id,rstemp1,sqltemp1,good,tiao_three,tiao_six
dim rstemp,sqltemp,leibie,tiao_two,tiao_four,tiao_serven,lb_yuanliao
dim rslast,sqllast,ht,tiao_one,tiao_five,tiao_eight,tiao_nine,pay_per,qita,bumen
supplier=trim(request("supplier"))
supplier_name=trim(request("supplier_name"))
postion=trim(request("postion"))
pay_out=trim(request("pay_out"))
need=trim(request("need"))
qixian=trim(request("qixian"))
tiao_one=trim(request("tiao_one"))
tiao_two=trim(request("tiao_two"))
tiao_three=trim(request("tiao_three"))
tiao_four=trim(request("tiao_four"))
tiao_five=trim(request("tiao_five"))
tiao_six=trim(request("tiao_six"))
tiao_serven=trim(request("tiao_serven"))
tiao_eight=trim(request("tiao_eight"))
tiao_nine=trim(request("tiao_nine"))
pay_per=trim(request("pay_per"))
qita=trim(request("qita"))
if supplier="" then
response.write "<script language=JavaScript >" & chr(13) & "alert('供应商供应商单位名称不能为空,请继续!');" & "history.back()" & "</script>"
response.end
end if
if need="" then
response.write "<script language=JavaScript >" & chr(13) & "alert('需方单位名称不能为空,请继续!');" & "history.back()" & "</script>"
response.end
end if
if qita="" then
response.write "<script language=JavaScript >" & chr(13) & "alert('其它约定事项内容不能为空,请继续!');" & "history.back()" & "</script>"
response.end
end if
set rstemp=server.createobject("ADODB.recordset")
sqltemp = "Select leibie From supplier where supplier='"&trim(request("need"))&"' and other='原料'"
rstemp.open sqltemp, conn,1,3
if not rstemp.eof then
lb_yuanliao=rstemp("leibie")
end if
rstemp.close
set rslast=server.createobject("ADODB.recordset")
sqllast = "Select id From hetong where id=(select max(id) from hetong)"
rslast.open sqllast, conn,1,3
if not rslast.eof then
good=rslast("id")
end if
rslast.close
set rec=server.createobject("ADODB.recordset")
rec.Open "SELECT * FROM hetong where id is null",conn,1,3
rec.AddNew
rec("supplier")=supplier
rec("supplier_name")=supplier_name
rec("postion")=postion
rec("pay_out")=pay_out
rec("need")=need
rec("qixian")=qixian
rec("ht_date")=date()
rec("input_name")=session("username")
rec("zhuangtai")="未审核"
response.write"lb_yuanliao&date()&good"
rec("hetong_no")=lb_yuanliao&date()&good
rec("tiao_one")=tiao_one
rec("tiao_two")=tiao_two
rec("tiao_three")=tiao_three
rec("tiao_four")=tiao_four
rec("tiao_five")=tiao_five
rec("tiao_six")=tiao_six
rec("tiao_serven")=tiao_serven
rec("tiao_eight")=tiao_eight
rec("tiao_nine")=tiao_nine
rec("pay_per")=pay_per
rec("qita")=qita
rec("leibie")="原料"
rec("modify")="否"
rec("bumen")=session("bumen")
rec.update
%>
<html>
<head>
<title>云蝠集团测试管理系统</title>
<meta http-equiv="Content-Type" >
<link rel="stylesheet" href="hetong.css" >
</head>
<body >
<table border="0" cellpadding="0" cellspacing="0" width="100%" >
<tr>
<td width=100% VALIGN=TOP>
<table width=100% border="0" cellspacing="0" cellpadding="0" >
<tr>
<td height=20></td>
</tr>
<tr>
<%
Response.Write "<td align=center>订单号为:<font color=red>"&rec("hetong_no")&"</font>的详细信息已经成功添加<br>"
Response.Write "请记住该订单号<a href='supplier_peizhi.asp'>返回</a></td>"
rec.close
set rec=nothing
%>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
<%else
%>
<script language=vbscript >
msgbox"你无权添加合同基本信息,请检查!"
location.href="supplier_peizhi.asp"
</script>
<%
end if
conn.Close
Set Conn=Nothing
%>