当前位置: 代码迷 >> ASP >> 恳请大家帮看一下数据库插入有关问题~多谢
  详细解决方案

恳请大家帮看一下数据库插入有关问题~多谢

热度:366   发布时间:2012-03-12 12:45:33.0
恳请大家帮看一下数据库插入问题~谢谢
<!--#include   file= "include/conn.asp "-->
<meta   http-equiv= "Content-Type "   content= "text/html;   charset=gb2312 ">
<title> 借书管理 </title>
<link   href= "css/yangshi.css "   rel= "stylesheet "   type= "text/css ">
<!--#include   file= "top.asp "-->
<%
if   session( "powerss ") <> 2   then
    response.Redirect   "admin_manage.asp "
    response.End()
end   if
if   request( "loginstyle ")= "查询 "   then
stunum=request.Form( "stunum ")
booknum=request.Form( "booknum ")
set   rs=server.CreateObject( "adodb.recordset ")
sql1= "select   *   from   book_info   where   booknum= ' "&booknum& " ' "
rs.open   sql1,conn,1,1
bookname=rs( "bookname ")
if   rs.bof   or   rs.eof   then
response.Write   " <script   language= 'javascript '> "&vbcr
response.Write   "alert( '没有此书登记! '); "&vbcr
response.Write   "history.go(-1); "&vbcr
response.Write   " </script> "
end   if
rs.close
end   if

if   request( "loginstyle ")= "提交 "   then
stunum=request.Form( "stunum ")
booknum=request.Form( "booknum ")
bookname=request.Form( "bookname ")
set   rs=server.CreateObject( "adodb.recordset ")
sql= "select   *   from   stu_info   where   stunum= ' "&stunum& " ' "
rs.open   sql,conn,1,1
if   rs.bof   or   rs.eof   then
response.Write   " <script   language= 'javascript '> "&vbcr
response.Write   "alert( '没有此学生帐号! '); "&vbcr
response.Write   "history.go(-1); "&vbcr
response.Write   " </script> "
response.End()
end   if
rs.close

sql2= "select   *   from   book_borrow   where   booknum= ' "&booknum& " ' "
'response.Write   sql2
'response.End()
rs.open   sql2,conn,1,1
if   not   rs.bof   and   not   rs.eof   then
response.Write   " <script   language= 'javascript '> "&vbcr
response.Write   "alert( '此书已借出! '); "&vbcr
response.Write   "history.go(-1); "&vbcr
response.Write   " </script> "
end   if
rs.close


borrow_date=date()
relay_date=dateadd( "d ",30,date())
renew=true

sql3= "select   *   from   book_order   where   booknum= ' "&booknum& " ' "
rs.open   sql3,conn,1,1                           '-----检查书是否在预约记录中
if   not   rs.bof   and   not   rs.eof   then
set   rs1=server.CreateObject( "adodb.recordset ")
sql4= "select   *   from   book_order   where   stunum= ' "&stunum& " '   and   booknum= ' "&booknum& " ' "
rs1.open   sql4,conn,1,1                           '-----检查是否是预约本人
  相关解决方案