XXXX_1.asp代码如下:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title></title>
<link href="Images/default.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" name="form1" method="post" action="xxxx_2.asp">
<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td height="24" colspan="2" class="AddGoods_Left"><div align="center">学生信息查询</div></td>
<td width="1%" height="24" colspan="2" align="right" valign="middle" bgcolor="#efefef"> </td>
</tr>
<tr>
<td width="43%" height="30" align="right" valign="middle" bgcolor="#efefef">学生姓名:</td>
<td width="56%" height="30" align="left" valign="middle" bgcolor="#EFEFEF">
<input name="name" type="text" id="name" size="25" maxlength="5" />
<span class="C_Title">
<input type="submit" name="Submit2" value=" 查 询 " />
</span> </td>
<td height="12" colspan="2" align="right" valign="middle" bgcolor="#efefef"> </td>
</tr>
</table>
</form>
</body>
</html>
xxxx_2.asp的代码如下:
<%
dim conn,connstr,db
db="DataBase/db.mdb"
set conn=Server.CreateObject("ADODB.CONNECTION")
connstr="Provider=Microsoft.Jet.OLEDB.4.0;data Source="&Server.MapPath(db)
conn.open connstr
%>
<%
dim name
name=Trim(Request.Form("name"))
if name="" then
set rs=server.createobject("Adodb.Recordset")
sql="Select * from student order by id desc"
rs.open sql,conn,1,3
xuehao=rs("xuehao")
name=rs("name")
xingbie=rs("xingbie")
chengji=rs("chengji")
ELSE
set rs=server.createobject("Adodb.Recordset")
sql="Select * from Staff where name='"&name& "'order by id desc"
rs.open sql,conn,1,3
if rs.eof then
Response.Write "<script language='javascript'>alert('没有查询到指定的学生信息记录');history.go(-1);</script>"
Response.End()
else
xuehao=rs("xuehao")
name=rs("name")
xingbie=rs("xingbie")
chengji=rs("chengji")
end if
end if
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title></title>
<link href="Images/default.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" name="form1" method="post" action="">
<table width="782" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="22" bgcolor="#F4F4F4"><div align="center">学生信息查询结果</div></td>
</tr>
<tr>
<td><%
if not RS.EOF then
while not RS.EOF%>
<table width="100%" height="60" border="0" cellpadding="0" cellspacing="1" bgcolor="#FFFFFF">
<tr> </tr>
<tr>
<td height="5" colspan="4" background="Images/topnav.gif"></td>
</tr>
<tr>
<td width="25%" height="25" align="middle" valign="middle" bgcolor="#efefef">学生学号:</td>
<td width="25%" height="25" align="middle" valign="middle" bgcolor="#EFEFEF">学生姓名:</td>
<td width="25%" height="25" align="middle" valign="middle" bgcolor="#EFEFEF">学生性别:</td>
<td width="25%" height="25" align="middle" valign="middle" bgcolor="#EFEFEF">学生成绩:</td>
</tr>
<tr>
<td width="25%" height="25" align="middle" valign="middle" bgcolor="#EFEFEF"><%=rs("xuehao")%></td>
<td width="25%" height="25" align="middle" valign="middle" bgcolor="#EFEFEF"> <%=rs("name")%> </td>
<td width="25%" height="25" align="middle" valign="middle" bgcolor="#EFEFEF"><%=rs("xingbie")%></td>
<td width="25%" height="25" align="middle" valign="middle" bgcolor="#EFEFEF"><%=rs("chengji")%></td>
</tr>
</table>
<%RS.movenext
wend
RS.close
end if
set rs=nothing
%></td>
</tr>
</table>
</form>
</body>
</html>
以上数据库路径和xxxx_1.asp里面的xxxx_2.asp都要修改一下,改成你自己使用的学号和路径,不是照着复制粘贴就可以用的,如果连这点小修改都不会那就太悲哀了。