ASP 回复留言错误
我回复留言出错出现:
错误类型:
ADODB.Field (0x80020009)
BOF 或 EOF 中有一个是“真”,或者当前的记录已被删除,所需的操作要求一个当前的记录。
/lyb2/reply.asp
reply.asp具体页面为:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="conn.asp" -->
<%
'接受传递过来的参数,并定义这个变量。
dim hf
hf = request.QueryString("id")
Set rs_m = Server.CreateObject("ADODB.Recordset")'用Recordset对象创建一个记录集,并存储记录rs_m。
Sql ="SELECT * FROM main where Name='"& hf &"'"
rs_m.open Sql, conn,1,1
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.
<html xmlns="http://www. InstanceBegin template="/Templates/mb.dwt.asp" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>学好网页>>在线留言</title>
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
<link href="css/css.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="800" height="40" border="0" align="center" cellpadding="0" cellspacing="0" background="images/dh.jpg" id="tbbg1">
<tr>
<td width="50" align="right">今天是:</td>
<td width="200"><div id="jnkc"><script>setInterval("jnkc.innerHTML=new Date().toLocaleString()+' 星期'+'日一二三四五六'.charAt(new Date().getDay());",1000);
</script></div></td>
<td width="500"><marquee direction="left" scrollamount="3" onmouseover=this.stop() onmouseout=this.start()>
感谢各位朋友前来欣赏我的留言本!!! </marquee>
</td>
<td width="50"> </td>
</tr>
</table>
<table width="800" height="150" border="0" align="center" cellpadding="0" cellspacing="0" id="tbbg2">
<tr>
<td><img src="images/top.gif" width="800" height="150" /><!-- InstanceBeginEditable name="可编辑区域1" -->
<table width="800" height="30" border="0" align="center" cellpadding="0" cellspacing="0" background="images/dh.jpg" id="tbbg3">
<tr>
<td width="300" align="center">网站名称>>>留言本</td>
<td width="200" align="left">当前为:添加留言</td>
<td width="300" align="center"><a href="index.asp">返回查看留言</a></td>
</tr>
</table>
<!-- InstanceEndEditable --><!-- InstanceBeginEditable name="可编辑区域2" -->
<table width="800" border="1" align="center" cellpadding="0" cellspacing="0" background="images/body1.jpg" id="zbbg1">
<tr>
<td height="50" align="center" class="wz24"><strong>管理回复留言</strong></td>
</tr>
<tr>
<td><form id="form1" name="form1" method="get" action="?">
<table width="600" border="1" align="center" cellpadding="0" cellspacing="0" id="zbbg1-2">
<tr>
<td width="100" height="30" align="right">留言人姓名:</td>
<td width="150"><input name="Name" type="text" class="bj" id="Name" value="<%=rs_m("Name")%>" size="15" maxlength="15" /></td>
<td width="170" align="right">留言人心情: </td>
<td width="180"><img src="<%=rs_m("Face")%>" name="Face" width="20" height="20" id="Face" /></td>
</tr>
<tr>
<td width="100" height="30" align="right">留言人QQ:</td>
<td><input name="QQ" type="text" class="bj" id="QQ" value="<%=rs_m("QQ")%>" size="15" maxlength="15" /></td>
<td align="right">留言人头像: </td>
<td rowspan="3"><img src="<%=rs_m("Icon")%>" name="Icon" width="90" height="90" id="Icon" /></td>
</tr>
<tr>
<td width="100" height="30" align="right">留言人UC:</td>
<td><input name="UC" type="text" class="bj" id="UC" value="<%=rs_m("UC")%>" size="15" maxlength="15" /></td>
<td align="right">留言人性别:<%=rs_m("Sex")%></td>
</tr>
<tr>
<td width="100" height="30" align="right">留言人主页:</td>
<td colspan="2"><input name="Homepage" type="text" class="bj" id="Homepage" value="<%=rs_m("Homepage")%>" size="40" maxlength="50" /></td>
</tr>
<tr>
<td width="100" height="30" align="right">留言人信箱:</td>
<td colspan="2"><input name="Email" type="text" class="bj" id="Email" value="<%=rs_m("Email")%>"size="40" maxlength="50" /></td>
<td>留言人来自:<%=rs_m("Lz")%></td>
</tr>
<tr>
<td width="100" height="30" align="right">留言人标题:</td>
<td colspan="2"><input name="Bt" type="text" class="Bj" id="bt" value="<%=rs_m("Bt")%>" size="40" maxlength="50" /></td>
<td>是否悄悄留言:<%=rs_m("Secret")%></td>
</tr>
<tr>
<td width="100" height="30" align="right">留言人内容:</td>
<td colspan="3"><textarea name="Content" cols="65" rows="5" class="bj" id="Content"><%=rs_m("Content")%></textarea></td>
</tr>
<tr>
<td height="30" align="right">回复时间:</td>
<td colspan="3"><input name="Rdate" type="text" id="Rdate" value="<%= now() %>" size="20" maxlength="20" />
是否悄悄回复:
<input name="Rsecret" type="checkbox" id="Rsecret" value="yes" /></td>
</tr>
<tr>
<td height="30" align="right">回复内容:</td>
<td colspan="3"><textarea name="Reply" cols="65" rows="3" id="Reply"><%=rs_m("Reply")%></textarea></td>
</tr>
<tr>
<td height="50" colspan="4" align="center"><input type="submit" name="Submit" value="添加留言" />
<input type="reset" name="Submit2" value="重 置" /></td>
</tr>
</table>
</form></td>
</tr>
</table>
<%
'1、以上是连接数据库页面
'2、声明变量,获取表单参数
dim Names,QQ,UC,Homepage,Email,Bt,Content,Rdate,Rsecret,Reply,Face,Icon,Lz,Secret
Names=request.Form("Name")
QQ=request.Form("QQ")
UC=request.Form("UC")
Homepage=request.Form("Homepage")
Email=request.Form("Email")
Bt=request.Form("Bt")
Content=request.Form("Content")
Rdate=request.Form("Rdate")
Rsecret=request.Form("Rsecret")
Reply=request.Form("Reply")
Face=request.Form("Face")
Icon=request.Form("Icon")
Lz=request.Form("Lz")
Secret=request.Form("Secret")
'12、为了解决,当用户打开此也页面是必须点击提交按钮后再显示提示框,因此这里加个if语句,意思是先获取提交按钮参数。
if request("Submit")="添加留言" then
Sql ="SELECT * FROM main"
set rs_m=server.createobject("adodb.recordset")
rs_m.open sql,conn,1,3 ' 用open打开记录集对象,将光标指向1,3 ,执行的是添加记录集
'2)、然后将获取的参数赋值给要添加记录的字段名
'rs.addnew '因为是修改记录,所以这里不需要了。
rs_m("Name")=request.Form("Name")
rs_m("QQ")=request.Form("QQ")
rs_m("UC")=request.Form("UC")
rs_m("Homepage")=request.Form("Homepage")
rs_m("Email")=request.Form("Email")
rs_m("Bt")=request.Form("Bt")
rs_m("Content")=request.Form("Content")
rs_m("Rdate")=request.Form("Rdate")
rs_m("Rsecret")=request.Form("Rsecret")
rs_m("Reply")=request.Form("Reply")
rs_m("Face")=request.Form("Face")
rs_m("Icon")=request.Form("Icon")
rs_m("Lz")=request.Form("Lz")
rs_m("Secret")=request.Form("Secret")
rs_m.update
set rs_m=nothing
set conn=nothing
Response.Write "<script language=""javascript"">window.alert('修改成功!请登陆');window.location.replace('admin.asp');</script>"
end if
%>
<!-- InstanceEndEditable --><!-- InstanceBeginEditable name="可编辑区域3" -->
<table width="800" height="30" border="0" align="center" cellpadding="0" cellspacing="0" background="images/dh.jpg" id="jbbg1">
<tr>
<td> </td>
</tr>
</table>
<!-- InstanceEndEditable -->
<table width="800" height="150" border="0" align="center" cellpadding="0" cellspacing="0" background="images/bottom.gif" id="jbbg2">
<tr>
<td align="center"><p>Copyright © 2004-2012 学好网页版权 All Rights Reserved</p>
<p>学好网页 <a href="http://wpa. title="点击这里给我发消息"><img src="images/oicq.gif" width="18" height="18" border="0">QQ留言</a> </p>
<p>2011年4月30日</p></td>
</tr>
</table></td>
</tr>
</table>
</body><!-- InstanceEnd -->
</html>
<%
rs_m.Close()
Set rs_m = Nothing
%>
请大家帮我改下可以吗??????