⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 addgy.asp

📁 创建和运行动态、交互的Web服务器应用程序
💻 ASP
字号:
<!--#include file="conn.asp"-->
<%
dim gyid,gy,gyindex
 
    gy     = Session("mycg") 
    gyindex= session("cgindex")

    action = request.QueryString("action")

select case action
       case "addgy"

if request.QueryString("gyid")="" then
   gyid=request("gyid")
else 
   gyid=request.QueryString("gyid")
end if

set rs=server.CreateObject("adodb.recordset")
    rs.open "select * from shop_gongyi where gyid="&gyid,conn,1,3

    gy(0,0)=gyid
    gy(0,1)=rs("zk")

    Session("mycg")   =gy
    gyindex           =gyindex+1
    session("cgindex")=gyindex
response.redirect "showgy.asp?action=gylist"

       '//增加数据
       case "addbk"

dim bookname,isbn,txm

bookname=request("bookname")
isbn    =request("isbn")
txm     =request("txm")

if bookname="" then bookname=request.QueryString("bookname")
if isbn=""     then isbn    =request.QueryString("isbn")
if txm=""      then txm     =request.QueryString("txm")
set rs=server.createobject("adodb.recordset")

if bookname="" and isbn="" and txm="" then 
    response.write "<script language=javascript>alert('您没有选择图书检索条件,请选择检索项!');window.location.reload('showgy.asp?action=gylist')</script>"
    response.end
end if
if (bookname<>"" and isbn<>"" and txm<>"") or (isbn<>"" and txm<>"") or (bookname<>"" and isbn<>"") or (bookname<>"" and txm<>"") then 
    response.write "<script language=javascript>alert('检索条件不能选多项,请选单个!');window.location.reload('showgy.asp?action=gylist')</script>"
    response.end
else
    if txm<>""      then  rs.open "select * from shop_books where booktxm="&txm,conn,1,1
    if bookname<>"" then  rs.open "select * from shop_books where bookname like '%"&bookname&"%' ",conn,1,1
    if isbn<>""     then  rs.open "select * from shop_books where isbn='"&isbn&"'",conn,1,1
     '//没有找到图书
    if  rs.eof and rs.bof then
        response.write "<script language=javascript>alert('没有找到该图书,请检查输入是否正确!');window.location.reload('showgy.asp?action=gylist')</script>"
        response.end
    else
       '//找到了图书
           bookid          = rs("bookid")
           bookname	   = rs("bookname")
           bkcount         = 1
           shichangjia     = rs("shichangjia")
           gyzk              = gy(0,1)

           if bkcount <>"" then
              bkcount=Cint(bkcount)

              '//检查数组
              for i=1 to gyindex
              '//是否重复
	         if bookid=gy(i,0) then

                    gy(i,2)=gy(i,2)+bkcount
                        Session("mycg") =  gy
                        gyindex           =  gyindex
                        session("cgindex")=  gyindex

                        response.redirect "showgy.asp?action=gylist"
                  end if
              next
              '//不重复
                 gy(gyindex,0)=bookid
                 gy(gyindex,1)=bookname
                 gy(gyindex,2)=bkcount
                 gy(gyindex,3)=shichangjia
                 gy(gyindex,4)=gyzk

                 Session("mycg") =gy
                 gyindex           =gyindex+1
                 session("cgindex")=gyindex
                 response.redirect"showgy.asp?action=gylist"
             else
	         response.write "<script language=javascript>alert('你没有选择图书数量!');window.location.reload('javascript:window.close()')</script>"
                 response.End
             end if
       end if
 end if
 
       '//修改数据
       case "adchange"
       index   = request.form("index")
       bkcount= request.form("bkcount")
       gyzk     = request.form("gyzk")

       if gyzk>1 then
          response.write "<script language=javascript>alert('折扣不能大于1!');window.location.reload('showgy.asp?action=gylist')</script>"
          response.End
       else
          gy(index,4)= gyzk
       end if

       gy(index,2)= bkcount
       Session("mycg")= gy
       response.redirect"showgy.asp?action=gylist"
        
       '//删除数据
       case "addelet"
       gy= Session("mycg")

       index= request("index")
       for i=0 to 4
	   gy(index,i)="0"
       next
       Session("mycg")= gy
       response.redirect"showgy.asp?action=gylist"
end select
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -