📄 chaxun1.asp
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%option explicit%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>查询系统</title>
</head>
<%
dim act
act=request.form("act")
if act="ok" then
call student()
response.end()
end if
sub student()
dim name
name=request.form("username")
name=trim(name)
if name="" then
response.write "<font color='red'>请输入您的姓名!</font> <a href='chaxun1.asp'>返回</a>"
response.end()
end if
name=replace(name,"'","")
name=replace(name,"=","")
dim connstr,conn,db
db="userinfo.mdb"
set conn=server.createobject("adodb.connection")
connstr="provider=microsoft.jet.oledb.4.0;data source="&server.mappath(db)
conn.open connstr
if err then
err.clear
set conn = Nothing
response.write "数据库连接出错,请检查conn.asp中的连接字符串。"
response.end
End if
dim rs,sql
sql="select * from xuesheng where xingming='"&name&"'"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
if rs.eof then
response.write("<font color='red'>对不起,找不到该姓名!</font>")
response.write("<input type='button' value='返回' onclick='window.history.back();'>")
response.end()
end if
response.write("查询结果<hr size='1'>")
Do While Not rs.EOF
response.write("您的姓名:"&name&"<br>")
response.write("您的学号:"&rs("xuehao")&"<br>")
response.write("您的专业:"&rs("zhuanye")&"<br>")
response.write("<br>")
response.write("感谢您的查询!<input type='button' value='返回' onclick='window.history.back();'>")
rs.MoveNext
Loop
rs.close
set rs=nothing
conn.close
set conn=nothing
end sub
%>
<body>
学生查询
<p align="right"><a href="guanli.asp">返回</a>
<hr size="1">
请输入您的姓名:
<form name="form1" method="post" action="chaxun1.asp">
<input name="username" type="text" id="name" maxlength="50">
<input type="submit" name="Submit" value="确定">
<input name="act" type="hidden" id="act" value="ok">
<br>
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -