表单的内容如何存入数据库中

来源:互联网 发布:手机虚拟摇杆软件 编辑:程序博客网 时间:2024/05/18 00:30
请问如何对接数据库,主要是下面红色字体部份,另外下面动态表格中的<input name="ku">此部份换成下拉菜单选择仓库。表格中的价格和条码自动取上行的进货价和条码,但在表格中也可以更改,表中的图片在表中上传,上传后回显,然后可以在表中删除

<%
if session("shiwei_username")="" then
%>
<script language="javascript">
top.location.href="../index.asp"
</script>
<%  
  response.end
end if
%>
<!-- #include file="../conn2.asp" -->
<!-- #include file="../const.asp" -->

<html>
<head>
<title><%=dianming%> - 产品入库</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../style/style.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<style>
body {
background-color:#FFFFFF;
}
     table{margin: 5px auto 0;}
.add,.remove{color: blue; text-decoration: underline; cursor: pointer; margin: 0 5px;} 
.i_color_error,.i_model_error{display: none; color: red;}
.pirce2,.shulian,.ku,.tiaoma{width: 100px;}
.pic{color: #333333; width: 150px;}
#i_model_add{background: #FF8000; color: #EEEEEE; padding: 3px 5px; box-shadow: 0px 1px 1px 1px #CCCCCC; border-radius: 3px; cursor: pointer; margin-left: 5px;}
</style>
</HEAD>

<BODY>
<%
if fla1="0" and session("shiwei_id")<>"1" then
%>
<br><center><img src="../images/note.gif" align="absmiddle">&nbsp;<font color="#FF0000">你不具备此权限,请与管理员联系!</font></center>
<%  
  response.end
end if
%>

<%
if request("hid1")="ok" then
nowid_login=request("id_login")
nowid_payment=request("id_payment")
set rs_login=conn.execute("select * from login where id="&nowid_login)
nowid_gys=request("id_gys")
nowgys=""
set rs_gys=conn.execute("select * from gys where id="&nowid_gys)
if rs_gys.eof=false then nowgys=rs_gys("company")
set rs_bianhao=conn.execute("select * from buy order by id desc")
if rs_bianhao.eof then
  nowbianhao=1000001
else
  nowbianhao=1000001+rs_bianhao("id")
end if

totalshulian=0
totalprice2=0
for x=1 to maxproduit
nowku=request("ku"&x)
set rs_ku=conn.execute("select * from ku where id="&nowku)
nowhuohao=request("huohao"&x)
nowshulian=request("shulian"&x)
nowprice=request("price"&x)
if nowprice="" then
  nowprice=0
end if
nowprice2=request("price2"&x)
if nowprice2="" then
  nowprice2=0
end if
nowprice3=request("price3"&x)
if nowprice3="" then
  nowprice3=0
end if
ddan=request("ddan")
wuliufee=request("wuliufee")

if nowhuohao<>"单击选择产品" and nowshulian<>"" then
set rs_produit=conn.execute("select * from produit where huohao='"&nowhuohao&"'")
beizhu=rs_produit("beizhu")
price2=rs_produit("price2")
price=rs_produit("price")
price3=rs_produit("price3")
set rs=server.createobject("ADODB.RecordSet")
sql="select * from produit where huohao='"&nowhuohao&"' and id_ku="&nowku
rs.open sql,conn,1,3
if rs.eof then
  rs.addnew
  rs("id_bigclass")=rs_produit("id_bigclass")
  rs("id_smallclass")=rs_produit("id_smallclass")
  rs("title")=rs_produit("title")
  rs("huohao")=rs_produit("huohao")
  rs("tiaoma")=rs_produit("tiaoma")
  rs("id_ku")=nowku
  rs("shulian")=nowshulian
  rs("danwei")=rs_produit("danwei")
  rs("price")=rs_produit("price")
  rs("price2")=nowprice2
  rs("price3")=rs_produit("price3")
  rs("sekuan")=rs_produit("sekuan")
  rs("guige")=rs_produit("guige")
  rs("jingzhong")=rs_produit("jingzhong")
  rs("zhuangxiangshu")=rs_produit("zhuangxiangshu")
  rs("baojin")=rs_produit("baojin")
  rs("class")=rs_produit("class")
  rs("duihuan")=rs_produit("duihuan")
  rs("tichen_type")=rs_produit("tichen_type")
  rs("tichen")=rs_produit("tichen")
  rs("photo")=rs_produit("photo")
  rs("gys")=nowgys
  rs("id_gys")=nowid_gys
  rs("beizhu")=beizhu
else
  rs("shulian")=rs("shulian")+nowshulian
  rs("price2")=nowprice2 
end if
rs.update
rs.close
sql="select bigclass from bigclass where id="&rs_produit("id_bigclass")
set rs_bigclass=conn.execute(sql)
sql="select smallclass from smallclass where id="&rs_produit("id_smallclass")
set rs_smallclass=conn.execute(sql)
if rs_smallclass.eof then
  smallclass=""
else
  smallclass=rs_smallclass(0)
end if
totalshulian=totalshulian+nowshulian
totalprice2=totalprice2+nowprice2*nowshulian
ddan=request("ddan")
wuliufee=request("wuliufee")

sql="insert into buy(ddan,wuliufee,id_payment,id_produit,bigclass,smallclass,title,huohao,tiaoma,id_ku,ku,shulian,sekuan,guige,jingzhong,zhuangxiangshu,id_login,login,type,selldate,price,price2,price3,photo,id_gys,gys,bianhao,beizhu) values('"&ddan&"','"&wuliufee&"',"&nowid_payment&","&rs_produit("id")&",'"&rs_bigclass(0)&"','"&smallclass&"','"&rs_produit("title")&"','"&nowhuohao&"','"&rs_produit("tiaoma")&"',"&rs_ku("id")&",'"&rs_ku("ku")&"',"&nowshulian&",'"&rs_produit("sekuan")&"','"&rs_produit("guige")&"','"&rs_produit("jingzhong")&"','"&rs_produit("zhuangxiangshu")&"',"&nowid_login&",'"&rs_login("username")&"',0,#"&date()&"#,'"&rs_produit("price")&"',"&nowprice2&",'"&rs_produit("price3")&"','"&rs_produit("photo")&"',"&nowid_gys&",'"&nowgys&"','"&nowbianhao&"','"&beizhu&"')"
conn.execute(sql)
end if
next
sql="insert into buy(ddan,wuliufee,id_payment,shulian,id_login,login,type,selldate,price,price2,price3,id_gys,gys,bianhao,zu) values('"&ddan&"','"&wuliufee&"',"&nowid_payment&","&totalshulian&","&nowid_login&",'"&rs_login("username")&"',0,#"&date()&"#,"&price&","&price2&","&price3&","&nowid_gys&",'"&nowgys&"','"&nowbianhao&"',true)"
conn.execute(sql)
%>
<script language="javascript">
alert("产品入库成功!")
</script> 
<%if dayin1="yes" then%>
<script language="javascript">
window.open('print_buy.asp?bianhao=<%=nowbianhao%>','打印','width=853,height=470,top=176,left=161,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,scrollbars=yes');
</script>
<%end if%>
<%
end if
%>



0 0
原创粉丝点击