asp缺少对象 20
在一个学生宿舍查询界面中,我在院系和专业两个菜单上加了联动显示的代码后,出现缺少对象的提示,请各位帮忙看看问题在哪儿:提示是楼号那个菜单中:rs1.movenext这句,...
在一个学生宿舍查询界面中,我在院系和专业两个菜单上加了联动显示的代码后,出现缺少对象的提示,请各位帮忙看看问题在哪儿:提示是楼号那个菜单中:rs1.movenext这句,
把我所有的分都给你啊
<%
<form id="form1" name="form1" method="get" action="zsgl51.asp">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="22%">楼号:
<label>
<select name="sellh">
<option>-----</option>
<% sql1="select distinct lh from room"
rs1.open sql1,conn,1,1
while not rs1.eof
response.write "<option value=" & rs1.fields(0).value & ">" & rs1.fields(0).value & "</option>"
rs1.movenext
wend
rs1.close
%>
</select>
</label></td>
<td>院系:
<%sql2="select distinct xsh from student" %>
<select name="selyx" id="selyx" onChange="changelocation(document.form1.selyx.options[document.form1.selyx.selectedIndex].value)">
<option selected value="----------">----------</option>
<%rs1.open sql2,conn,1,1
dim selxsh
selxsh=rs1("xsh")
while not rs1.eof
%>
<option value="<%=trim(rs1("xsh"))%>"><%=trim(rs1("xsh"))%></option>
<%
rs1.movenext
wend
rs1.close
%>
</select></td>
<td align="left">专业:
<label>
<select name="selzy">
<option selected>----------</option>
<%
sql3="select distinct zyh from student where xsh='" & selxsh & "'"
rs1.open sql3,conn,1,1
do while not rs1.eof%>
<option value="<%=rs1("zyh")%>"><%=rs1("zyh")%></option>
<%
rs1.movenext
loop
rs1.close
%>
</select>
</label></td>
<td align="center" valign="middle">是否欠费
<label>
<input type="checkbox" name="checkqf" value="true">
</label>
<input id="btn" type="submit" name="Submit" value="搜索" /></td>
</tr>
</table>
</form> 展开
把我所有的分都给你啊
<%
<form id="form1" name="form1" method="get" action="zsgl51.asp">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="22%">楼号:
<label>
<select name="sellh">
<option>-----</option>
<% sql1="select distinct lh from room"
rs1.open sql1,conn,1,1
while not rs1.eof
response.write "<option value=" & rs1.fields(0).value & ">" & rs1.fields(0).value & "</option>"
rs1.movenext
wend
rs1.close
%>
</select>
</label></td>
<td>院系:
<%sql2="select distinct xsh from student" %>
<select name="selyx" id="selyx" onChange="changelocation(document.form1.selyx.options[document.form1.selyx.selectedIndex].value)">
<option selected value="----------">----------</option>
<%rs1.open sql2,conn,1,1
dim selxsh
selxsh=rs1("xsh")
while not rs1.eof
%>
<option value="<%=trim(rs1("xsh"))%>"><%=trim(rs1("xsh"))%></option>
<%
rs1.movenext
wend
rs1.close
%>
</select></td>
<td align="left">专业:
<label>
<select name="selzy">
<option selected>----------</option>
<%
sql3="select distinct zyh from student where xsh='" & selxsh & "'"
rs1.open sql3,conn,1,1
do while not rs1.eof%>
<option value="<%=rs1("zyh")%>"><%=rs1("zyh")%></option>
<%
rs1.movenext
loop
rs1.close
%>
</select>
</label></td>
<td align="center" valign="middle">是否欠费
<label>
<input type="checkbox" name="checkqf" value="true">
</label>
<input id="btn" type="submit" name="Submit" value="搜索" /></td>
</tr>
</table>
</form> 展开
展开全部
基本语法如下:(例子)
set rs=server.createobject("adodb.recordset") 你就是少了这句。
sql="select name,age from class where id=33"
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write("none data")
rs.close
set rs=nothing
response.end
else
response.write(rs("name"))
response.write(rs("age"))
end if
rs.close
set rs=nothing
其中:
conn是连接数据库的变量,这个书上都有。
set rs=server.createobject("adodb.recordset") 你就是少了这句。
sql="select name,age from class where id=33"
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write("none data")
rs.close
set rs=nothing
response.end
else
response.write(rs("name"))
response.write(rs("age"))
end if
rs.close
set rs=nothing
其中:
conn是连接数据库的变量,这个书上都有。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询