为什么我这个代码会进入类似死循环的状态呢???

langya001 2006-05-12 04:58:43
<!--#include file="conn.asp"-->
<!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="stlye.css" rel="stylesheet" type="text/css" />
<script>
function SearchFrom(Search)
{
if(Search.value.length==6)
{
var tt=Search.value;
var conn = new ActiveXObject("ADODB.Connection");

conn.Open("Provider=SQLOLEDB.1;Data Source=localhost; User ID=sa; Password=; Initial Catalog=shangchuan");
var objRs = new ActiveXObject("ADODB.Recordset");
strSql="select * from Oper where card='"+tt+"'";

objRs.open(strSql,conn);
if(!objRs.EOF)
{
form1.name.value=objRs("name");
}
else
{
alert("数据库中没有数据");
}
objRs.close();objRs=null;conn.close();conn=null;
}
}
</script>
</head>

<body>
<p> </p>
<p> </p>
<p> </p>
<table width="780" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="center"><h1>2006年一季度销售员业绩查询系统</h1></td>
</tr>
<tr><form id="form1" name="form1" method="post" action="">
<td align="center">

身份证: <input name="card" type="text" class="input" id="card" size="20" onkeyup="SearchFrom(this)" />
    销售员名称:
<input name="name" type="text" class="input" id="username" size="6" maxlength="6" />
<input type="hidden" name="Search" value="GO" />
   <input type="submit" class="input" value="查询" />
  <input type="reset" class="input" value="重置" /></td></form>
</tr>
<%
If Request.Form("Search")="GO" Then
%>
<tr>
<td height="70" align="center"><table width="780" border="1" cellpadding="0" cellspacing="0" bordercolor="#dddddd">
<tr>
<td align="center">销售员姓名</td>
<td align="center">销售员身份证号</td>
<td align="center">第一季度业绩</td>
<td align="center">是否完成任务</td>
<td align="center">任务量</td>
<td align="center">实际完成数</td>
</tr>
<%
Set objRs1=Server.CreateObject("Adodb.Recordset")
SQL="Select * From Oper Where Card Like "&Request.Form("card")
objRs1.open SQL,objConn,1,1

Do While Not objRs1.Eof
Response.Write "<tr>"
Response.Write "<td align='center'>"&objRs1("name")&"</td>"
Response.Write "<td align='center'>"&objRs1("card")&"</td>"
Response.Write "<td align='center'>"&objRs1("yegi")&"</td>"
Response.Write "<td align='center'>"&objRs1("task")&"</td>"
Response.Write "<td align='center'>"&objRs1("capacity")&"</td>"
Response.Write "<td align='center'>"&objRs1("fact")&"</td>"
Response.Write "</tr>"
Loop
objRs1.Close
Set objRs1=Nothing
Response.Write "</table></td></tr>"
End If
%>
</table>
</body>
</html>

一运行就卡死。。郁闷
...全文
119 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
langya001 2006-05-12
  • 打赏
  • 举报
回复
晕。。原来是这么基本的错误。。我真的够笨。。多谢楼上两位
lamking 2006-05-12
  • 打赏
  • 举报
回复
Loop前没有rs.movenext,这样,你的循环永远也不会结束.当染就是死循环
mhxz5680 2006-05-12
  • 打赏
  • 举报
回复
Do While Not objRs1.Eof
Response.Write "<tr>"
Response.Write "<td align='center'>"&objRs1("name")&"</td>"
Response.Write "<td align='center'>"&objRs1("card")&"</td>"
Response.Write "<td align='center'>"&objRs1("yegi")&"</td>"
Response.Write "<td align='center'>"&objRs1("task")&"</td>"
Response.Write "<td align='center'>"&objRs1("capacity")&"</td>"
Response.Write "<td align='center'>"&objRs1("fact")&"</td>"
Response.Write "</tr>"
objRs1.movenext ------------------>看这行
Loop
objRs1.Close

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧