这个do while语句请大家诊断!
chxlp 2002-02-05 03:04:08 有关这个do while loop语句的源程序如下:
结果运行时说do while 语句有MS VBScript编译错误,但是我左看右看都不知道错在那里,请大家瞧瞧吧!谢!
<%
application("DSN")="MSORACLE"
application("UserName")="thweb"
application("PASSWORD")="thweb"
Connstr = "DSN=" & application("DSN") & ";UID=" & application("UserName") & ";PWD=" & application("PASSWORD")
Set Conn = server.createobject("adodb.connection")
Conn.Open Connstr
%>
<form name="grdh" method="post" action="grdh1.asp">
请输入要查询的姓名:
<input type="text" name="name" size="8" value="输入姓名" onmouseover=this.focus() onfocus=this.select()>
<input type="submit" value="提交" name="B12" >
<input type="reset" value="重写" name="B22" onclick="grdh.name.focus()">
</form>
<%
request.form("name")
if name<>"" then
sql1="select * from person_Phone where name like '%" &name& "%'"
set rs1=conn.execute(sql1)
sql2="select count(*) from person_Phone where name like '%" &name& "%'"
set rs2=conn.execute(sql2)
number=rs2(0)
rs2.close
set rs2=nothing
i=1
do while i<number and not rs1.eof
%>
<div align="center">
<table width="100%" border="1">
<tr>
<td width="10%">
<div align="center"><b><font color="#008040">序号</font></b></div>
</td>
<td width="20%">
<div align="center"><b><font color="#008040">姓 名</font></b></div>
</td>
<td width="20%">
<div align="center"><b><font color="#008040">电 话</font></b></div>
</td>
<td width="10%">
<div align="center"><b><font color="#008040">序号</font></b></div>
</td>
<td width="20%">
<div align="center"><b><font color="#008040">姓 名</font></b></div>
</td>
<td width="20%">
<div align="center"><b><font color="#008040">电 话</font></b></div>
</td>
</tr>
<tr>
<td width="10%"><%=i%></td>
<td width="20%"><%=rs1("name")%></td>
<td width="20%"><%=rs1("phone")%></td>
<%
i=i+1
rs1.movenext
if i<=number then %>
<td width="10%"><%=i%></td>
<td width="20%"><%=rs1("name")%></td>
<td width="20%"><%=rs1("phone")%></td>
<% else %>
<td width="10%"> </td>
<td width="20%"> </td>
<td width="20%"> </td>
<% end if %>
</tr>
<% i=i+1
rs1.movenext
loop
else
response.write ("请输入被查询者姓名!")
end if
%>
</table>