ASP程序 更新数据库记录
<%UID=request("UID")setrs=server.CreateObject("adodb.recordset")str1="select*fromprod...
<%
UID=request("UID")
set rs=server.CreateObject("adodb.recordset")
str1="select* from product_out where otpto='翠微店' and oBarcode='" & UID &"'"
rs.open str1,connstr,1,3
set rs3=server.CreateObject("adodb.recordset")
str3="Select * From BookInfo where Barcode='" & UID &"'"
rs3.open str3,connstr,1,3
set rs2=server.CreateObject("adodb.recordset")
str2="Select * From zk_tuihuo"
rs2.open str2,connstr,1,3
rs2.addnew
rs2("zkBarcode")=Rs("oBarcode")
rs2("zkBookName")=Rs("oBookName")
rs2("zkTypeName")=Rs("oTypeName")
rs2("zkBookAuthor")=Rs("oBookAuthor")
rs2("zkBookpublished")=Rs("oBookpublished")
rs2("zkBooksCount")=Request.Form("tpcount")
rs2("zkISBN")=Request.Form("ISBN")
rs2("zkPublishyear")=Request.Form("tpdate")
rs2("zkBookID")=Request.Form("BookID")
rs2("zktpto")=Request.Form("tiaopeito")
rs2.update
rs2.close
set rs2=nothing
Countr2=rs("oBookleft")
Countr=rs3("Bookleft")
tpcount=Request.Form("tpcount")
count2=Countr2-tpcount
count3=Countr+tpcount
str="update BookInfo set Bookleft="&count3 &" where Barcode='"&UID&"'"
str2="update product_out set oBookleft="&count2 &" where otpto='翠微店' and oBarcode='"&UID&"'"
conn.execute(str)
conn.execute(str2)
Response.Write("<script language:javascript>javascript:window.opener=null;window.close();</script>")
%>
此段代码涉及三个表 实现的功能是分店向总店退货 增加一条退货记录的同时更新分店和总店的数据 分店剩余货量减去退货数 总店增加退货数
现在是增加退货记录没有问题 总店和分店的退货记录不更新!!!
如果单独更新一个表是没有问题的 比如说退货后分店剩余货量减少 难道两个表不能同时更新吗 展开
UID=request("UID")
set rs=server.CreateObject("adodb.recordset")
str1="select* from product_out where otpto='翠微店' and oBarcode='" & UID &"'"
rs.open str1,connstr,1,3
set rs3=server.CreateObject("adodb.recordset")
str3="Select * From BookInfo where Barcode='" & UID &"'"
rs3.open str3,connstr,1,3
set rs2=server.CreateObject("adodb.recordset")
str2="Select * From zk_tuihuo"
rs2.open str2,connstr,1,3
rs2.addnew
rs2("zkBarcode")=Rs("oBarcode")
rs2("zkBookName")=Rs("oBookName")
rs2("zkTypeName")=Rs("oTypeName")
rs2("zkBookAuthor")=Rs("oBookAuthor")
rs2("zkBookpublished")=Rs("oBookpublished")
rs2("zkBooksCount")=Request.Form("tpcount")
rs2("zkISBN")=Request.Form("ISBN")
rs2("zkPublishyear")=Request.Form("tpdate")
rs2("zkBookID")=Request.Form("BookID")
rs2("zktpto")=Request.Form("tiaopeito")
rs2.update
rs2.close
set rs2=nothing
Countr2=rs("oBookleft")
Countr=rs3("Bookleft")
tpcount=Request.Form("tpcount")
count2=Countr2-tpcount
count3=Countr+tpcount
str="update BookInfo set Bookleft="&count3 &" where Barcode='"&UID&"'"
str2="update product_out set oBookleft="&count2 &" where otpto='翠微店' and oBarcode='"&UID&"'"
conn.execute(str)
conn.execute(str2)
Response.Write("<script language:javascript>javascript:window.opener=null;window.close();</script>")
%>
此段代码涉及三个表 实现的功能是分店向总店退货 增加一条退货记录的同时更新分店和总店的数据 分店剩余货量减去退货数 总店增加退货数
现在是增加退货记录没有问题 总店和分店的退货记录不更新!!!
如果单独更新一个表是没有问题的 比如说退货后分店剩余货量减少 难道两个表不能同时更新吗 展开
1个回答
展开全部
<%
UID=request("UID")
set rs2=server.CreateObject("adodb.recordset")
str2="Select * From zk_tuihuo"
rs2.open str2,connstr,1,3
rs2.addnew
rs2("zkBarcode")=Rs("oBarcode")
rs2("zkBookName")=Rs("oBookName")
rs2("zkTypeName")=Rs("oTypeName")
rs2("zkBookAuthor")=Rs("oBookAuthor")
rs2("zkBookpublished")=Rs("oBookpublished")
rs2("zkBooksCount")=Request.Form("tpcount")
rs2("zkISBN")=Request.Form("ISBN")
rs2("zkPublishyear")=Request.Form("tpdate")
rs2("zkBookID")=Request.Form("BookID")
rs2("zktpto")=Request.Form("tiaopeito")
rs2.update
rs2.close
set rs2=nothing
set rs=server.CreateObject("adodb.recordset")
str1="select* from product_out where otpto='翠微店' and oBarcode='" & UID &"'"
rs.open str1,connstr,1,1
set rs3=server.CreateObject("adodb.recordset")
str3="Select * From BookInfo where Barcode='" & UID &"'"
rs3.open str3,connstr,1,1
Countr2=rs("oBookleft")
Countr=rs3("Bookleft")
tpcount=Request.Form("tpcount")
count2=Countr2-tpcount
count3=Countr+tpcount
str="update BookInfo set Bookleft="&count3 &" where Barcode='"&UID&"'"
str2="update product_out set oBookleft="&count2 &" where otpto='翠微店' and oBarcode='"&UID&"'"
conn.execute(str)
conn.execute(str2)
Response.Write("<script language:javascript>javascript:window.opener=null;window.close();</script>")
%>
这样就行了 你试试
UID=request("UID")
set rs2=server.CreateObject("adodb.recordset")
str2="Select * From zk_tuihuo"
rs2.open str2,connstr,1,3
rs2.addnew
rs2("zkBarcode")=Rs("oBarcode")
rs2("zkBookName")=Rs("oBookName")
rs2("zkTypeName")=Rs("oTypeName")
rs2("zkBookAuthor")=Rs("oBookAuthor")
rs2("zkBookpublished")=Rs("oBookpublished")
rs2("zkBooksCount")=Request.Form("tpcount")
rs2("zkISBN")=Request.Form("ISBN")
rs2("zkPublishyear")=Request.Form("tpdate")
rs2("zkBookID")=Request.Form("BookID")
rs2("zktpto")=Request.Form("tiaopeito")
rs2.update
rs2.close
set rs2=nothing
set rs=server.CreateObject("adodb.recordset")
str1="select* from product_out where otpto='翠微店' and oBarcode='" & UID &"'"
rs.open str1,connstr,1,1
set rs3=server.CreateObject("adodb.recordset")
str3="Select * From BookInfo where Barcode='" & UID &"'"
rs3.open str3,connstr,1,1
Countr2=rs("oBookleft")
Countr=rs3("Bookleft")
tpcount=Request.Form("tpcount")
count2=Countr2-tpcount
count3=Countr+tpcount
str="update BookInfo set Bookleft="&count3 &" where Barcode='"&UID&"'"
str2="update product_out set oBookleft="&count2 &" where otpto='翠微店' and oBarcode='"&UID&"'"
conn.execute(str)
conn.execute(str2)
Response.Write("<script language:javascript>javascript:window.opener=null;window.close();</script>")
%>
这样就行了 你试试
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询