关于数据传递,两表之间互相读取数据,其中有一个连接参数,如何实现?

climix 2005-06-07 09:50:36
源代码:
<!--#include file="conn.asp" -->
<% if session.contents("b_right")<"2" and session.contents("b_right")>"0" then %>


<%
dim order_no,supplier,shaxian,color,ganghao,weight,contents,real_zhishu,zhishu_piancha,real_huichao,biaozhong_per,real_change
dim one_bu,two_bu,gan_mo,shi_mo,color_mao,zhipian,shougan,ceshi_member,wuli_member,naixi_member,mo_member,other_member
dim rs,rec,strsql,sql
order_no=trim(request("order_no"))
supplier=trim(request("supplier"))
shaxian=trim(request("shaxian"))
color=trim(request("color"))
ganghao=trim(request("ganghao"))
weight=trim(request("weight"))
contents=trim(request("contents"))
real_zhishu=trim(request("real_zhishu"))
real_huichao=trim(request("real_huichao"))
one_bu=trim(request("one_bu"))
two_bu=trim(request("two_bu"))
gan_mo=trim(request("gan_mo"))
shi_mo=trim(request("shi_mo"))
zhipian=trim(request("zhipian"))
shougan=trim(request("shougan"))
color_mao=trim(request("color_mao"))
real_change=trim(request("real_change"))


if order_no="" or supplier="" then
response.write "<script language=JavaScript >" & chr(13) & "alert('订单号、供应商其中一项没有填写!');" & "history.back()" & "</script>"
response.end
end if
if shaxian="" or color="" then
response.write "<script language=JavaScript >" & chr(13) & "alert('纱线、颜色其中一项没有填写!');" & "history.back()" & "</script>"
response.end
end if
if ganghao="" or weight="" then
response.write "<script language=JavaScript >" & chr(13) & "alert('缸号、净重其中一项没有填写!');" & "history.back()" & "</script>"
response.end
end if
if real_zhishu="" then
response.write "<script language=JavaScript >" & chr(13) & "alert('实测一项没有填写!');" & "history.back()" & "</script>"
response.end
end if
if real_huichao="" then
response.write "<script language=JavaScript >" & chr(13) & "alert('实测一项没有填写!');" & "history.back()" & "</script>"
response.end
end if
if real_change="" or one_bu="" or two_bu="" then
response.write "<script language=JavaScript >" & chr(13) & "alert('原样变化、第一块贴衬沾色和第二块贴衬沾色其中一项没有填写!');" & "history.back()" & "</script>"
response.end
end if
if gan_mo="" or shi_mo="" then
response.write "<script language=JavaScript >" & chr(13) & "alert('干摩擦、湿摩擦其中一项没有填写!');" & "history.back()" & "</script>"
response.end
end if
set rs=server.createobject("ADODB.recordset")
sql = "Select biaozhong_per,zhishu_piancha From shaxian where shaxian='"&trim(request("shaxian"))&"'"
set rs = conn.Execute(sql)
rs.open sql, conn,1,3
if not rs.eof then
biaozhong_per=rs("biaozhong_per")
zhishu_piancha=rs("zhishu_piancha")
end if
set rec=server.createobject("ADODB.recordset")
rec.Open "cs_main", conn, 1, 3
rec.AddNew
rec("order_no")=order_no
rec("supplier")=supplier
rec("shaxian")=shaxian
rec("color")=color
rec("ganghao")=ganghao
rec("weight")=weight
rec("real_zhishu")=real_zhishu
rec("real_huichao")=real_huichao
rec("real_change")=real_change
rec("zhishu_piancha")=zhishu_piancha
rec("biaozhong_per")=biaozhong_per
rec("one_bu")=one_bu
rec("two_bu")=two_bu
rec("gan_mo")=gan_mo
rec("shi_mo")=shi_mo
rec("color_mao")=color_mao
rec("zhipian")=zhipian
rec("shougan")=shougan
rec("contents")=contents
rec("pass_go")="未通过"
rec("ceshi_member")=session("username")
rec("leibie")="原料"
rec("wuli_member")="张齐娣"
rec("naixi_member")="张齐娣"
rec("mo_member")="顾艳娟"
rec("other_member")="樊丽娟\陈建梅"
rec("ceshi_date")=date()
rec.update
rec.close
set rec=nothing

%>
<html>
<head>
<title>新闻发布子系统</title>
</head>

<meta http-equiv="Content-Type" >
<link rel="stylesheet" href="book.css" >
<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>原料测试基本信息已经成功添加<br>"
Response.Write "<a href='main_test.asp'>返回</a></td>"

%>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
<%else
%>
<script language=vbscript >
msgbox"你无权添加原料测试基本信息,请检查!"
location.href="main_test.asp"
</script>
<%end if%>
两个表中,有相关的主键shaxian,报错
Microsoft VBScript 编译器错误 错误 '800a03f6'

缺少 'End'

/iisHelp/common/500-100.asp,行242

ADODB.Recordset 错误 '800a0e79'

对象打开时,不允许操作。

/ceshi/main_test_save.asp,行59

...全文
160 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
dh20156 2005-06-07
  • 打赏
  • 举报
回复
rec("order_no")是自动增长的主键么?
dh20156 2005-06-07
  • 打赏
  • 举报
回复
set rs = conn.Execute(sql)
rs.open sql, conn,1,3

------------>改一下,删掉上边的
rs.open sql, conn,1,3
hawk2004 2005-06-07
  • 打赏
  • 举报
回复
UP~

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧