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

📄 userdel.asp

📁 tushuguanlixitong 图书借阅系统 用ASP实现的 能实现简单的功能
💻 ASP
字号:
<html> 
     <head>
     <title></title>
     </head>
     <body bgcolor=#FF6600>
<%
dim userno
dim username
dim borrownumber
dim flag
dim flag1
flag = 1
flag1 = 1
dim strConn
dim strSQL
dim objrst

userno = request.Form("userno")
username = request.Form("username")
  if  (userno = "") or (username = "")  then 
%>
<table border="1" width="100%" id="table2">
	<tr>
		<td align="center"><b><font size="4">用户号与用户名不能为空!</font></b></td>
	</tr>
	<tr>
		<td align="center"> </td>
	</tr>
	<tr>
		<td align="center"><b><font size="4">请<a href="usermanger.asp">返回</a>!</font></b></td>
	</tr>
</table>

<%   
   
       userno = 0
       flag1 = 0
       
      
      else
      if  not(isnumeric(userno)) then      
         response.redirect  "numbererr.asp"
      end if
      
   End if
strConn = "DSN=dblib;uid=;pwd=;database=db"
strSQL ="select * from Tuser where userno = " & userno & "and username = '"& username &"'" 

set objrst = GetADORecordset(strConn,strSQL)
      
      if objrst.bof and objrst.eof then
         if (flag1 = 1)  then
%>      
     
     <table border="0" width="100%">
		<tr>
			<td align="center"><font size=5 color=navy><b>您输入的用户号和用户名不符!请重新输入!</td>
		</tr>
		<tr>
			<td align="center"> </td>
		</tr>
		<tr>
			<td align="center"><font size=5 color=navy><b>
			<a href="usermanger.asp">返回</a></td>
		</tr>
		</table>
	<%	End if %>
	     
 	 <%  flag = 0 
 	 else 
 	  borrownumber = objrst.fields("borrownumber")
 	   	 
 	 End if		   
 %>   
<%	
     if  (flag = 1) then 
     
       if (borrownumber >=1) then 
 %>
 <table border="1" width="100%">
		<tr>
			<td align="center"><b><font size="4"> 用户还有借书未返还,禁止删除!</font></b></td>
		</tr>
		<tr>
			<td align="center"> </td>
		</tr>
		<tr>
			<td align="center"><b><font size="4"> 请<a href="usermanger.asp">返回</a>!</font></b></td>
		</tr>
	</table>
 <%   else      
    dim strConn1
	dim strSQL1
	dim objrst1
	strConn1 = "DSN=dblib;uid=;pwd=;database=db"
	strSQL1 = "delete from Tuser where userno = " & userno & " and username = '" & username & "'"
 	
     
	Set Conn1 = Server.CreateObject("ADODB.Connection")
	Set objrst1= Server.CreateObject("ADODB.Recordset")
	Conn1.Open strConn1
	
	objrst1.Open strSQL1, Conn1, 0, 1
	Conn1.Close
	Set Conn1 = Nothing
	
	
%>


<table border="1" width="100%" height="50%" id="table1">
	<tr>
		<td align="center"><b><font size="4">用户删除成功</font></b></td>
	</tr>
	<tr>
		<td align="center"><a href="usermanger.asp">返回</a></td>
	</tr>
	<tr>
		<td> </td>
	</tr>
</table>

<%
  end if
 end if
%>
</body>
</html>
<%
'======================================================================
'  GetADORecordset -- Gets an ADO recordset given a connectionstring,
'  sql query string.
'
'==============================
Function GetADORecordset(strConn, strSQL)
	On Error Resume Next
	 
	Dim objConnection
	Dim objRecordset
	
	Err.Clear 
	
	' Setup an ADO connection to the database:
	Set objConnection = Server.CreateObject("ADODB.Connection")
    Set objRecordset = Server.CreateObject("ADODB.Recordset")
    
    objConnection.ConnectionString = strConn
    objConnection.Open
    Set objRecordset.ActiveConnection = objConnection
    objRecordset.Source = strSQL
    objRecordset.CursorLocation = 3
    objRecordset.Open
	
	If Err Then
		Set GetADORecordset = Nothing
		If Not HaveError() Then
			SetError "GetADORecordset", Err.number, Err.Description
		End If
	Else
		Set GetADORecordset = objRecordset
	End If 
End Function

%>

⌨️ 快捷键说明

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