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

📄 badd.asp

📁 在线图书销售系统
💻 ASP
字号:
<%@ Language=VBScript %>
<%option explicit%>
<% dim book,errmsg,founderr,author,price,publish,photo,memo,num
   dim class1
   founderr=false
   book=Request("book")
   
   author=request("author")
   if author="" then author="无"
   price=request("price")
   publish=request("publish")
   if publish="" then publish="无"
   photo=request("photo")
   if photo="" then photo=""
   num=request("num")
   
   class1=request("class")
   if class1="" then class1="其他"
   memo=request("memo")
   if memo="" then memo="无"
   if price="" then  
      errmsg=errmsg & "价格不能为空!"
      founderr=true
   end if
   if num="" then 
      errmsg=errmsg & "数量不能为空!"
      founderr=true
   end if
   if book="" then
      founderr=true
      errmsg="书名不能为空!" & errmsg
   end if
    if founderr then
      Response.Write errmsg
      %>
<HTML>
<HEAD>
<TITLE>添加图书</TITLE>
</HEAD>
<BODY>
<br>
<form method="post" action="">
    <table border="0" width="100%">
    <tr>
      <td width="100%" bgcolor="#000080"><font color="#ffffff">书籍添加</font></td>
    </tr>
    <tr>
      <td width="100%" bgcolor="#fcfdee">书&nbsp; 名<input name="book" value="<%=book%>" >作者<input name="author" value="<%=author%>" >单价<input name="price" size="12" value="<%=price%>"          
 >类别<input type="text" name="class" size="13" value="<%=class1%>"></td>                 
    </tr>                 
    <tr>                 
      <td width="100%" bgcolor="#fcfdee">出版社<input name="publish" value="<%=publish%>">照片<input name="photo" value="<%=photo%>"          
     >数量<input name="num" size="11" value="<%=num%>"></td>                 
    </tr>                 
    <tr>                 
      <td width="100%" bgcolor="#fcfdee"><TEXTAREA cols=91 name=memo rows=11><%=memo%></TEXTAREA></td>                 
    </tr>                 
    <tr>                 
      <td width="100%" bgcolor="#fcfdee"><input type="submit" value="提交" name="B1" ></td>                 
    </tr>                 
    <tr>                 
      <td width="100%" bgcolor="#000080"> </td>                 
    </tr>                 
  </table>                 
                
</form>                 
             
</BODY>                 
</HTML>           
<%Response.End           
else          
   'Response.Write title          
   dim connstr,conn,rs,sql           
   connstr="dbq="+server.MapPath("mdb/bookshop.mdb")+";defaultdir=;driver={microsoft access driver (*.mdb)};"           
   set conn=server.CreateObject("adodb.connection")           
   conn.Open connstr           
   set rs=server.CreateObject("adodb.recordset")           
   sql="select * from book"           
   rs.open sql,conn,3,3           
   if rs.EOF=true then           
	  rs.MoveLast            
   end if           
   rs.AddNew            
   rs("book")=book          
   rs("author")=author           
   'rs("date")=date()          
   rs("price")=csng(price)          
   rs("publish")=publish          
   rs("photo")=photo          
   rs("num")=cint(num)          
   rs("memo")=memo          
   rs.Update            
   rs.Close            
   conn.Close            
   set conn=nothing           
   set rs=nothing           
   %>           
   <script language="javascript">           
    alert("已经成功添加了一条记录!谢谢!")          
   top.document.location="manage.htm"           
    </script>          
              
   <%          
   end if%>                 

⌨️ 快捷键说明

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