ASP BOF 或 EOF 中有一个是“真”
<body><%DimAodAod="1"if(Request("id")<>"")ThenAod=Request("id")EndIf%><%SetRs=Server....
<body>
<%
Dim Aod
Aod = "1"
if (Request("id") <> "") Then
Aod = Request("id")
End If
%>
<%
Set Rs = Server.CreateObject("ADODB.RecordSet")
Sql="Select * From info Where id="&Aod
Rs.Open Sql,conn,3,3
%>
<form id="form1" name="form1" id="form1" method="post" action="Admin_amend_1.asp?action=SaveAdd">
<table width="600" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="35" colspan="2"><div align="center">添加文章</div></td>
</tr>
<tr>
<td height="15" colspan="2"><div align="center">标题:
<input name="title" type="text" id="title" value="<%=rs("title")%>" />
</div></td>
</tr>
<tr>
<td width="300" height="40" valign="middle"> </td>
<td width="300" height="40" valign="middle"> </td>
</tr>
<tr>
<td height="230" colspan="2" valign="top">
<label>
<textarea name="content" id="content" rows="18"><%=rs("content")%></textarea>
</label> </td>
</tr>
<tr>
<td height="50"><div align="right"><input type="submit" name="tijiao" id="tijiao" value="提交" /> </div></td>
<td height="50"><input type="reset" name="chongzhi" id="chongzhi" value="重置" /></td>
</tr>
</table>
</form>
<% If Request("action")="SaveAdd" Then
Call SaveAdd()
End If
%>
<% Sub SaveAdd()
dim title
dim content
content = request.form("content")
title = request.form("title")
Rs("title") = title
Rs("content") = content
Rs.UpDate
Response.Write "<script>alert('添加成功!');location.href='Admin_amend_1.asp';</script>"
End Sub
%>
<%
Rs.close
Set Rs=nothing
%>
</body>
错误提示:ADODB.Field 错误 '80020009'
BOF 或 EOF 中有一个是“真”,或者当前的记录已被删除,所需的操作要求一个当前的记录。
/test/Admin_amend_1.asp,行 0
这个怎么解决 ? 展开
<%
Dim Aod
Aod = "1"
if (Request("id") <> "") Then
Aod = Request("id")
End If
%>
<%
Set Rs = Server.CreateObject("ADODB.RecordSet")
Sql="Select * From info Where id="&Aod
Rs.Open Sql,conn,3,3
%>
<form id="form1" name="form1" id="form1" method="post" action="Admin_amend_1.asp?action=SaveAdd">
<table width="600" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="35" colspan="2"><div align="center">添加文章</div></td>
</tr>
<tr>
<td height="15" colspan="2"><div align="center">标题:
<input name="title" type="text" id="title" value="<%=rs("title")%>" />
</div></td>
</tr>
<tr>
<td width="300" height="40" valign="middle"> </td>
<td width="300" height="40" valign="middle"> </td>
</tr>
<tr>
<td height="230" colspan="2" valign="top">
<label>
<textarea name="content" id="content" rows="18"><%=rs("content")%></textarea>
</label> </td>
</tr>
<tr>
<td height="50"><div align="right"><input type="submit" name="tijiao" id="tijiao" value="提交" /> </div></td>
<td height="50"><input type="reset" name="chongzhi" id="chongzhi" value="重置" /></td>
</tr>
</table>
</form>
<% If Request("action")="SaveAdd" Then
Call SaveAdd()
End If
%>
<% Sub SaveAdd()
dim title
dim content
content = request.form("content")
title = request.form("title")
Rs("title") = title
Rs("content") = content
Rs.UpDate
Response.Write "<script>alert('添加成功!');location.href='Admin_amend_1.asp';</script>"
End Sub
%>
<%
Rs.close
Set Rs=nothing
%>
</body>
错误提示:ADODB.Field 错误 '80020009'
BOF 或 EOF 中有一个是“真”,或者当前的记录已被删除,所需的操作要求一个当前的记录。
/test/Admin_amend_1.asp,行 0
这个怎么解决 ? 展开
展开全部
'你可以在记录集打开后检查是否为空:
<%
Set Rs = Server.CreateObject("ADODB.RecordSet")
Sql="Select * From info Where id="&Aod
Rs.Open Sql,conn,3,3
'在这里加上
if Rs.bof and Rs.eof then
response.write "未找到记录"
else
%>
......
......
<%
'这里加上
end if
Rs.close
Set Rs=nothing
%>
'另外
<%
Dim Aod
Aod = "1"
if (Request("id") <> "") Then
Aod = Request("id")
End If
%>
'这里的Aod可能是字符类型"1"所以查不到结果,你可以改为:
<%
Dim Aod
Aod = cint(Request("id"))
if Aod="" or not isnumeric(Aod) or Aod=0 then Aod=1
%>
<%
Set Rs = Server.CreateObject("ADODB.RecordSet")
Sql="Select * From info Where id="&Aod
Rs.Open Sql,conn,3,3
'在这里加上
if Rs.bof and Rs.eof then
response.write "未找到记录"
else
%>
......
......
<%
'这里加上
end if
Rs.close
Set Rs=nothing
%>
'另外
<%
Dim Aod
Aod = "1"
if (Request("id") <> "") Then
Aod = Request("id")
End If
%>
'这里的Aod可能是字符类型"1"所以查不到结果,你可以改为:
<%
Dim Aod
Aod = cint(Request("id"))
if Aod="" or not isnumeric(Aod) or Aod=0 then Aod=1
%>
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询