求助!利用"用户名和身份证号码"进行成绩查询,如何实现?
本人编程有点问题,在数据库中有此用户名和身份证号码时,
都老显示用户等不存在~~~~~~~
想请问一下高手!
连接的第一个find.asp文件:(应该有问题,帮忙该正确!谢谢)
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="admin/Conn.asp"-->
<%
dim xm,idnumber
xm= trim(request.Form("xm" ))
idnumber= trim(request.Form("idnumber"))
if xm="" or idnumber="" then
response.Write "<p align=center>出错提示:用户名、身份证号码不能为空!</p>"
response.Write "<p align=center><a href=Index.asp>单击此处重新进入成绩查询页面</a></p>"
else
set rs=server.createobject("adodb.recordset")
sql="select * from cj where xm='"&xm&"' and idnumber='"&idnumber&"'"
rs.open sql,conn,1,1
end if
if not rs.eof then
if idnumber=rs("idnumber") then
session("xm")=xm
session("idnumber")=xm
session("xm")=idnumber
response.redirect "cj.asp"
else
Response.Write "<script language='javascript'>window.confirm('身份证号码不正确,请后退重填!!');</script>"
Response.Write "<script language='javascript'>parent.window.history.go(-1);</script>"
end if
else
Response.Write "<script language='javascript'>window.confirm('用户名不正确!!');</script>"
Response.Write "<script language='javascript'>parent.window.history.go(-1);</script>"
end if
rs.Close
Set rs= Nothing
%>
第二个文件cj.asp:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<html >
<body>
<font size="4" > <b> 普通话成绩</b></font><br>
<table width="445" height="49" border="1" align="center" bordercolor="#000000">
<tr>
<td width="89" height="43" align="center"><div align="center">姓名</div></td>
<td width="163" align="center"><div align="center">身份证号码</div></td
><td width="171" align="center"><div align="center">成绩</div></td>
</tr>
<!--#include file="admin/Conn.asp"-->
<%
dim xm,idnumber
xm= trim(request.Form("xm" ))
idnumber= trim(request.Form("idnumber"))
set rs=server.createobject("adodb.recordset")
sql="select * from cj where xm='"&xm&"' and idnumber='"&idnumber&"'"
rs.open sql,conn,1,1
%>
<%
do while (not rs.eof )
response.write "<tr>"
response.write "<td>"&rs("xm")&"</td>"
response.write "<td>"&rs("idnumber")&"</td>"
response.write "<td>"&rs("scort")&"</td>"
response.write "</tr>"
rs.movenext
loop
rs.close
set rs=nothing
Conn.close
set Conn=nothing
%>
</table>
</body>
</html>