错误提示:BOF 或 EOF 为 True,或者当前记录已被删除。请求的操作需要当前记录。
我有从另一个站点接收 id 的代码,它是一个数字,并将编辑与 id 匹配的数据。
<body>
<table style="width: 100%">
<tr>
<!-- #include file="header.html"-->
</tr>
</table>
<table>
<tr >
<td style="width:885px" class="style2" >
<%
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "C:\inetpub\wwwroot\library\database.mdb"
cid=Request.Form("number")
if Request.form("firstname")="" then
set rs=Server.CreateObject("ADODB.Recordset")
rs.open "SELECT * FROM users WHERE no='" & cid & "'",conn
%>
<form method="post" action="change.asp">
<table>
<%for each x in rs.Fields%>
<tr>
<td><% Response.Write(x.name)%></td>
<td><input name='<%Response.Write(x.name)%>' value='<%Response.Write(x.value)%>'></td>
<%next%>
</tr>
</table>
<br /><br />
<input type="submit" value="Update record">
</form>
<%
else
sql="UPDATE users SET "
sql=sql & "firstname='" & Request.Form("firstname") & "',"
sql=sql & "lastname='" & Request.Form("lastname") & "',"
sql=sql & "Gender='" & Request.Form("Gender") & "'"
sql=sql & " WHERE no='" & cid & "'"
on error resume next
conn.Execute sql
if err<>0 then
response.write("No update permissions!")
else
response.write("Record " & cid & " was updated!")
end if
end if
conn.close
%>
</td>
<td><!--#include file="sideMenu.html"-->
</td>
</tr>
</table>
</body>