![]() |
#2
度乐2010-01-19 11:20
<!--#include file="conn.asp"-->
<% if request("bookname")="" then response.Write "对不起,添加失败,请用正确的方式添加票品!" response.End end if function HTMLEncode2(fString) fString = Replace(fString, CHR(13), "") fString = Replace(fString, CHR(10) & CHR(10), "</P><P>") fString = Replace(fString, CHR(10), "<BR>") HTMLEncode2 = fString end function dim bookdate,dazhe dazhe=trim(request("huiyuanjia")) dim action,bookid bookid=request.QueryString("id") action=request.QueryString("action") shjianame=request.cookies("cnhww")("shjianame") select case action case "add" set rs=server.CreateObject("adodb.recordset") rs.Open "select * from products",conn,1,3 rs.AddNew rs("mch")=trim(request("mch")) rs("pp")=trim(request("pp")) rs("isbn1")=trim(request("isbn1")) rs("jj")=trim(request("jj")) rs("jg")=trim(request("jg")) rs("zl")=trim(request("zl")) rs("tp")=trim(request("tp")) rs("nr")=trim(request("nr")) rs("bh")=trim(request("bh")) rs("anclassid")=int(request("anclassid")) rs("nclassid")=int(request("nclassid")) rs("bookname")=trim(request("bookname")) rs("grade")=trim(request("grade")) rs("pingpai")=trim(request("pingpai")) rs("isbn")=trim(request("isbn")) rs("jssj")=trim(request("jssj")) rs("bookchuban")=trim(request("bookchuban")) rs("huiyuanjia")=trim(request("huiyuanjia")) rs("vipjia")=trim(request("vipjia")) rs("dazhe")=dazhe rs("bookpic")=trim(request("bookpic")) rs("zhuang")=trim(request("zhuang")) rs("qwtp")=Trim(request("qwtp")) rs("ditu")=Trim(request("ditu")) rs("bookcontent")=htmlencode2(trim(request("bookcontent"))) if request("bestbook")=1 then rs("bestbook")=1 else rs("bestbook")=0 end if if request("newsbook")=1 then rs("newsbook")=1 else rs("newsbook")=0 end if if request("tejiabook")=1 then rs("tejiabook")=1 else rs("tejiabook")=0 end If if request("huigubook")=1 then rs("huigubook")=1 else rs("huigubook")=0 end if rs("liulancount")=0 rs("adddate")=now() rs("pingji")=0 rs("pingjizong")=0 rs.Update bookid=rs("bookid") rs.Close set rs=Nothing set rs1=server.CreateObject("adodb.recordset") rs1.Open "select * from piaojiab",conn,1,3 rs1.AddNew rs1("piaojia")=trim(request("shichangjia1")) rs1("kucun")=trim(request("kucun")) rs1("chengjiaocount")=Trim(request("chengjiaocount")) rs1("leiyanbid")=bookid rs1("piaojiaid")=bookid rs1("jifen")=trim(request("yeshu")) rs1.close Set rs1=nothing response.Write "<script language=javascript>alert('添加成功!');history.go(-2);</script>" response.End case "edit" set rs=server.CreateObject("adodb.recordset") rs.Open "select * from products where bookid="&bookid,conn,1,3 rs("mch")=trim(request("mch")) rs("pp")=trim(request("pp")) rs("isbn1")=trim(request("isbn1")) rs("jj")=trim(request("jj")) rs("jg")=trim(request("jg")) rs("zl")=trim(request("zl")) rs("tp")=trim(request("tp")) rs("nr")=trim(request("nr")) rs("bh")=trim(request("bh")) rs("anclassid")=int(request("anclassid")) rs("nclassid")=int(request("nclassid")) rs("bookname")=trim(request("bookname")) rs("pingpai")=trim(request("pingpai")) rs("grade")=trim(request("grade")) rs("isbn")=trim(request("isbn")) rs("jssj")=trim(request("jssj")) rs("bookchuban")=trim(request("bookchuban")) rs("huiyuanjia")=trim(request("huiyuanjia")) rs("vipjia")=trim(request("vipjia")) rs("dazhe")=dazhe rs("bookpic")=trim(request("bookpic")) rs("zhuang")=trim(request("zhuang")) rs("qwtp")=trim(request("qwtp")) rs("ditu")=trim(request("ditu")) rs("bookcontent")=trim(request("bookcontent")) if request("bestbook")=1 then rs("bestbook")=1 else rs("bestbook")=0 end if if request("newsbook")=1 then rs("newsbook")=1 else rs("newsbook")=0 end if if request("tejiabook")=1 then rs("tejiabook")=1 else rs("tejiabook")=0 end If if request("huigubook")=1 then rs("huigubook")=1 else rs("huigubook")=0 end if rs.Update rs.Close set rs=Nothing set rs1=server.CreateObject("adodb.recordset") rs1.Open "select * from piaojiab",conn,1,3 rs1("piaojia")=trim(request("piaojia")) rs1("kucun")=trim(request("kucun")) rs1("chengjiaocount")=Trim(request("chengjiaocount")) rs1("leiyanbid")=bookid rs1("piaojiaid")=bookid rs1("jifen")=trim(request("jifen")) rs1.close Set rs1=Nothing response.Write "<script language=javascript>alert('修改成功!');history.go(-2);</script>" response.End end select %> 这个是数据存储页,请高手看下,哪儿错了要改!!! |
我现在是有两个表,一个是产品表,一个是价格表;我想在添加产品表里把各项都写全了,在处理页分别存到数据库中。
试了几个方法都 是不行。而且产品价格是一个动态的。一个产品分三六九等,票价不同。票价还不能定死了,得动态添加。
保存到数据库的时候好像这又涉及到一个批量数据处理吧,搞不明白了,望高手教我!!!
最好能举个例子,能详细点是最好了,多谢了!