将表单中一个字段同时存储到数据库两个不同表中?

这段代码展示了如何在ASP中处理表单数据并将其存储到数据库表produce1中。问题在于如何将'hjsl'字段同时写入到名为KU的另一个表中。目前代码仅处理了produce1表的更新,需要修改以实现数据的同步写入。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

将表单中的一个字段同时存储到一个数据库两个不同表中?代码如下!现在只是往produce1 这个表写数据,我还想同时让("hjsl")这个字段写进 KU 这个表中,这个表中字段名也是hjsl
请各位高手指教!怎么改造代码!
<%
sub AddProduce()
if request("action")="del" then
conn.execute("delete from produce1 where productid in ("&request("productid")&")")
elseif request("action")="edit" then
set rs=server.createobject("adodb.recordset")
if request("productid")<>"" then
sql="select * from produce1 where productid="&request("productid")
rs.open sql,conn,1,3
else
sql="select * from produce1"
rs.open sql,conn,1,3
rs.addnew
end if
rs("rq")=request("rq")
rs("jccm")=request("jccm")
rs("Hjid")=request("Hjid")
rs("kcsl")=request("kcsl")
rs("cksl")=request("cksl")
rs("rksl")=request("rksl")
rs("hjsl")=request("hjsl")
rs("TypeAid")=request("TypeAid")
rs("TypeB")=request("TypeB")
rs("lyr")=request("lyr")
rs("tjr")=request("tjr")
rs("bz")=request("bz")
if Cint(request("commend"))=1 then
rs("commend")=1
rs("productdate")=now()
else
rs("commend")=0
rs("productdate")=now()
end if

rs.update
end if
response.write "<script>alert('操作成功,请继续!');window.history.go(-1);</script>"
response.end
end sub
%>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值