📄 userupdate.asp
字号:
<!--#INCLUDE FILE="database/conn.asp"-->
<%
Response.Write "<form name=form1>"
Dim Method,oRs
Method = Request.QueryString("method")
Select case Method
case "add"
Add(conn)
case "edit"
Edit(conn)
case "Delete"
Delete(conn)
case "Query"
call Query(conn,Method)
case "check"
check(conn)
case "uncheck"
uncheck(conn)
case "xiugaiPwd"
xiugaiPwd(conn)
End Select
Sub Add(conn)
dim student_no,st_name,xibie,zhuanye,banji,tel,jianshu,Ifadmission, errmsg
student_no=Trim(request.form("student_no")) '用户ID
st_name=Trim(Request.Form("st_name"))
xibie=Trim(request.Form("xibie"))
zhuanye=Trim(request.Form("zhuanye"))
banji= Trim(request.Form("banji"))
tel=Trim(Request.Form("tel"))
Ifadmission=trim(Request.Form("Ifadmission"))
jianshu=Request.Form("jianshu") '以上为传递数据到变量。
errmsg = ""
' if student_no="" then errmsg= "student_no not null "
' if st_name="" then errmsg=errmsg & " name not null "
' if xibie="" then errmsg=errmsg & "xibie not null ! "
' if tel="" then errmsg=errmsg & "tel not null !"
' if zhuanye="" then errmsg=errmsg & " zhuanye not null "
' if banji="" then errmsg=errmsg & " banji not null ! "
' if jianshu="" then errmsg=errmsg & " jianshu not null ! "
if errmsg<>"" then
Response.Write ("errmsg") %>
<script language="javascript">
alert("<%=errmsg%>")
history.back();
</script>
<% else
Set rs = Server.CreateObject("ADODB.RECORDSET")
sql="select * from student where student_no='" &student_no&"'"
rs.open sql,conn,3,3
if not Rs.eof then
%>
<table width=620 height="171" align=left>
<tr>
<td colspan="2" height="38"> <%=" you can not register The num had used by other student!!"%> </td>
</tr>
<tr>
<td colspan="2" height="52"> </td>
</tr>
<tr>
<td width="193" align=right>
<input type=button value="返回" name=cmdback onclick="history.back()">
</td>
</tr>
</table>
<%
exit sub
CleanUp(oRs)
else
rs.AddNew
rs("student_no")=Trim(student_no)
rs("st_name")=Trim(st_name)
rs("xibie")=Trim(xibie)
rs("zhuanye")=Trim(zhuanye)
rs("banji")=Trim(banji)
rs("tel")=Trim(tel)
rs("Ifadmission")=trim(Ifadmission)
rs("jianshu")=Trim(jianshu)
rs.Update
rs.Close
conn.Close
set conn=nothing
set rs=nothing %>
<table>
<tr>
<td>successfull<A href=shenqing.asp> Go back </A></td>
</table>
<%
'Response.Redirect "useradd.asp"
end if
end if
End Sub
'////////////////////////////////////////////////////////////////////////////////////
%>
<%
Sub Edit(conn)
dim student_no,st_name,xibie,zhuanye,banji,tel,jianshu
dim EditSql
student_no="'"& trim(Request.Form("student_no"))&"'"
st_name="'"& trim(Request.Form("st_name"))&"'"
xibie="'"& trim(Request.Form("xibie"))&"'"
zhuanye="'"& trim(Request.Form("zhuanye"))&"'"
banji="'"& trim(Request.Form("banji"))&"'"
tel="'"& trim(Request.Form("tel"))&"'"
jianshu="'"& trim(Request.Form("jianshu"))&"'"
conn.execute( "update student set st_name="&st_name&",zhuanye="&zhuanye&",xibie="&xibie&",tel="_
&tel&",banji="&banji&",jianshu="&jianshu &" where student_no="&student_no )
if error>0 then
response.Write(" the data have not right!!")
else response.Write(" edit data successfull <A href=../student/student_info.asp> Go back!</A>")
End if
' conn.nothing
Response.Redirect "../student/student_info.asp"
End Sub
'////////////////////////////////////////////////////////////////////////////////////
Sub xiugaiPwd(conn)
Dim id,password,password1,password2
id= Request.Form("id")
password=request.form("password")
password1=request.form("password1")
password2=request.form("password2")
if password1<>password2 then %>
<table>
<tr>
<td>
<script language="javascript">
alert("密码和密码确认不一致,请返回!")
history.back();
</script>
</td>
</table>
<%
exit sub
end if
sql="select password from userlist where password= '"&password &"'"
sql =sql &" and id=" &id
rs.open sql,conn,3,3
if not Rs.eof then
conn.execute "update userlist set password='" &password1 &"' where id="& id
%>
<table>
<tr>
<td>密码修改完毕,请点击<A href=../xiugaiPwd.asp>返回</A></td>
</table>
<%else%>
<table>
<tr>
<td>
<script language="javascript">
alert("旧密码不正确,你不能更改密码,请返回!")
history.back();
</script>
</td>
</table>
<%end if
rs.close
conn.close
End Sub
'////////////////////////////////////////////////////////////////////////////////////
Sub check(conn)
Dim plusDevicplat,i,checksql
for each student_no in Request.Form("mid")
if Session("admin.name")="sa" and Session("Ifadmission")="1" then
checksql="update student set ifadmission='1' where student_no='" &student_no&"'"
conn.execute(checksql)
end if
next%>
<table>
<tr>
<td>数据审批完毕,请点击<A href=../student/student_info.asp>返回</A></td>
</table>
<%
conn.close
End Sub
'////////////////////////////////////////////////////////////////////////////////////
Sub uncheck(conn)
Dim plusDevicplat,i,unchecksql
for each stduent_no in Request.Form("mid")
if Session("admin.name")="sa" and Session("Ifadmission")="1" then
unchecksql="update student set ifadmission='0' where student_no='" &student_no&"'"
conn.execute(unchecksql)
end if
next%>
<table>
<tr>
<td>数据未批准完毕,请点击<A href=../student/student_info.asp>返回</A></td>
</table>
<%
conn.close
End Sub
'////////////////////////////////////////////////////////////////////////////////////
Sub Delete(conn)
Dim plusDevicplat,i,delsql
for each student_no in Request.Form("mid") '循环删除每一个
delsql="delete from student where student_no='"&student_no&"'"
conn.execute(delsql)
next%>
<table>
<tr>
<td>数据删除成功,请点击<A href=../student/student_info.asp>返回</A></td>
</table>
<%
conn.close
End Sub%>
</form>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -