?? adduserdone.asp
字號:
<%
%>
<!--#include file='../conn.asp'-->
<%
UserName = request("UserName") '獲取需要添加的用戶名
UserName = replace(UserName,"'","''") '替換用戶名中的'符號
UserPass = request("UserPass") '獲取用戶密碼
UserPass = replace(UserPass,"'","''") '替換用戶名中的'符號
UserSection = Cint(request("S_Section")) '獲取用戶部門ID并轉換為Int型
UserAdmin = Cint(request("IsAdmin")) '獲取用戶Admin標識并轉換為Int型
set rs = conn.execute("select * from [User] where UserName ='"&UserName&"'")
'查詢數據庫
if not (rs.bof or rs.eof) then '如果記錄不為空 , 說明已經有重名的用戶
response.write "<script language=javascript>" 'Javascript 開始
response.write"alert('該用戶名已經存在!');" '警告
response.write"location.href='addUser.asp';" '跳轉到addUser.asp頁面
response.write "</script>" 'Javascript 結束
response.end '停止解析,執行Javascript
end if
rs.close '如果為空,則可以添加該用戶名,關閉rs
sql="insert into [User] (UserName,UserPass,UserSection,IsAdmin) values('"&UserName&"','"&UserPass&"',"&UserSection&","&UserAdmin&")" '將新用戶數據添加到數據庫
conn.execute( sql ) '執行Sql
%>
<html>
<head>
<title>添加新用戶</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"><META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<LINK
href="../css.css" type=text/css rel=stylesheet>
</head>
<body>
<br>
<table width="100%" border="0" cellspacing="0" cellpadding="0" align=center>
<tr>
<td width="100%" height="197" align="center">
<table border="0" cellspacing="0" cellpadding="0" height="85" bgcolor="#99ccff" width="100%">
<tr>
<td align="center">
<a href="addUser.asp" class=linkblue2>已創建新用戶記錄</a>
<script>
setTimeout("location.replace('addUser.asp')",2000)
</script>
</td>
</tr>
</table>
</td>
</tr>
</table>
<p>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -