asp数据库只显示第一条记录,为什么啊
代码:<%@LANGUAGE="VBSCRIPT"CODEPAGE="65001"%><!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Tra...
代码:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!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=utf-8" />
<title>成绩查询</title>
</head>
<%
cc=request("exam_no")
if cc<> "" then
'response.Write(cc)
%>
<%
Dim conn, rs,Driver, SourceType, DBPath
On Error Resume Next
Set GetOtherRs = Nothing
Driver = "Driver={Microsoft Visual FoxPro Driver};"
SourceType = "SourceType=DBF;"
DBPath = "SourceDB=" & Server.MapPath( ".")
Set conn = GetConnection( Driver & SourceType & DBPath )
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open Driver & SourceType & DBPath
Set conn = conn
Set rs = Server.CreateObject("ADODB.Recordset")
m=val(cc)
exec="select * from qq "
'rs.Open "Select * From qq", conn, 2, 2
If rs Is Nothing Then
Response.Write "GetDbfRecordset 调用失败!"
Response.End
End If
%>
<%
set rs=server.createobject("adodb.recordset")
rs.open exec,conn,1,1
conn.execute exec
%>
<table width="100%" border="1" cellspacing="0" cellpadding="10">
<TR>
<TH > aa </TH>
<TH > bb </TH>
<TH > cc </TH>
</TR> <P>
<%do while not rs.eof
response.Write(cc)
if rs("aa")=cc then%>
<tr>
<td><%=rs("aa") %></td>
<td><%=rs("bb") %></td>
<td><%=rs("cc") %></td>
</tr>
<%
exit do
end if
rs.movenext
loop
else
response.write("请输入您的准考证号!")
end if
%>
</table>
<body>
</body>
</html>
exit do 去掉的话,输出全部的记录 展开
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!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=utf-8" />
<title>成绩查询</title>
</head>
<%
cc=request("exam_no")
if cc<> "" then
'response.Write(cc)
%>
<%
Dim conn, rs,Driver, SourceType, DBPath
On Error Resume Next
Set GetOtherRs = Nothing
Driver = "Driver={Microsoft Visual FoxPro Driver};"
SourceType = "SourceType=DBF;"
DBPath = "SourceDB=" & Server.MapPath( ".")
Set conn = GetConnection( Driver & SourceType & DBPath )
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open Driver & SourceType & DBPath
Set conn = conn
Set rs = Server.CreateObject("ADODB.Recordset")
m=val(cc)
exec="select * from qq "
'rs.Open "Select * From qq", conn, 2, 2
If rs Is Nothing Then
Response.Write "GetDbfRecordset 调用失败!"
Response.End
End If
%>
<%
set rs=server.createobject("adodb.recordset")
rs.open exec,conn,1,1
conn.execute exec
%>
<table width="100%" border="1" cellspacing="0" cellpadding="10">
<TR>
<TH > aa </TH>
<TH > bb </TH>
<TH > cc </TH>
</TR> <P>
<%do while not rs.eof
response.Write(cc)
if rs("aa")=cc then%>
<tr>
<td><%=rs("aa") %></td>
<td><%=rs("bb") %></td>
<td><%=rs("cc") %></td>
</tr>
<%
exit do
end if
rs.movenext
loop
else
response.write("请输入您的准考证号!")
end if
%>
</table>
<body>
</body>
</html>
exit do 去掉的话,输出全部的记录 展开
3个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询