ASP 没有记录存在,但数据库中有该条记录

来源:百度知道 编辑:UC知道 时间:2024/05/23 00:31:52
BOF 或 EOF 中有一个是“真”,或者当前的记录已被删除,所需的操作要求一个当前的记录。
代码如下:
<%
Dim connstr
connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &Server.MapPath("shiyan.mdb")
Set cn=Server.Createobject("ADODB.Connection")
cn.Open connstr
%>

<%

Set rs=Server.CreateObject("Adodb.RecordSet")
exec="select * from sevaluation where s_number='" & request("s_user") & "'"
rs.Open exec ,cn,1,1
%>
<%
if rs.bof and rs.eof then
response.write "no record"
response.end
else

%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="

if rs.bof and rs.eof then
response.write "no record"
response.end
else
改成
if rs.bof or rs.eof then
response.write "no record"
response.end
else
就应该不会报错了.
至于为什么读不到记录的问题.可以是你的参数不对
可能是request("s_user") 这个参数为空了.又或者是,条件不符.