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>作者: 唏唏鉿鉿HJP 时间: 2010-1-9 08:49
将sql语句显示出来,然后放到access里面执行,看看是不是没有符合的记录作者: bgag 时间: 2010-1-9 08:49
你那种是c的写法,vbs里面用楼主那种写法没错作者: 五龙 时间: 2010-1-9 08:49
if xm="" or idnumber="" then
response.Write "<p align=center>出错提示:用户名、身份证号码不能为空!</p>"
response.Write "<p align=center><a href=Index.asp>单击此处重新进入成绩查询页面</a></p>"
这个if写的是不是不对啊!
if(xm=""||idnumber="")then....