各位ASP大虾救命啊!

来源:百度知道 编辑:UC知道 时间:2024/06/01 02:53:59
错误类型:
ADODB.Field (0x80020009)
BOF 或 EOF 中有一个是“真”,或者当前的记录已被删除,所需的操作要求一个当前的记录。
这是我的代码,调试总是出现上面的错误。哪位大虾帮帮忙啊。我急着交设计!

<%
stu_no=request.QueryString("stu_no")
order_no=request.QueryString("order_no")
set cn= Server.CreateObject("adodb.connection")
cn.connectionstring="provider=microsoft.jet.oledb.4.0;data source="&server.MapPath("data\xinxi.mdb")
cn.open
set rs= Server.CreateObject("adodb.recordset")
sql="select name,banji,xibie,no from student where no='"&stu_no&"'"
rs.open sql,cn,1,3

%>
<table width="40%" border="1" cellpadding="1" cellspacing="1" align="center">
<tr>
<td bgcolor="#007fff" width="80"><font color="#FFFFFF">学号</font></td>

首先看看你的学号字段是文本型还是数据型,如果是数据型的话就所SQL语句中的两个单引号去掉.

我将你的代码改为如下,你试试看.
<%
stu_no=request.QueryString("stu_no")
order_no=request.QueryString("order_no")
set cn= Server.CreateObject("adodb.connection")
cn.connectionstring="provider=microsoft.jet.oledb.4.0;data source="&server.MapPath("data\xinxi.mdb")
cn.open
set rs= Server.CreateObject("adodb.recordset")
sql="select name,banji,xibie,no from student where no='"&stu_no&"'"
rs.open sql,cn,1,3
if not (rs.eof or rs.bof) then '如果记录不为空的话就执行下面的操作
%>
<table width="40%" border="1" cellpadding="1" cellspacing="1" align="center">
<tr>
<td bgcolor="#007fff" width="80"><font color="#FFFFFF">学号</font></td>
<td><%=stu_no%> </td>