不知错在哪里啦。

wbqc9912115 2003-10-21 11:54:24
<!--#include file="conn.asp"-->
<html>
<head>
<title>最简留言本</title>
<LINK href="style.css" rel=stylesheet type=text/css>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"></head>
<body leftmargin="1" topmargin="0">
<%
Set rs = Server.CreateObject ("ADODB.Recordset")
sql = "SELECT * FROM Liuyan ORDER BY id DESC"
rs.open conn,1,1 //。。。。。。。。。。。。。。本行有错。
If rs.Bof And rs.Eof Then
Response.Write("<center>还没有任何留言!<br>请<a href=""Add.htm"">添加新留言</a></center>")
Response.End
End If
Do While Not rs.eof
%>
<table align=center width=65% cellspacing=1 cellpadding=4 bgcolor="#999999">
<tr>
<td width=72 height="" align=center valign="middle" bgcolor="#003366"><font
color="#FFFFFF">留言本:</font></td></tr>
<tr>
<td width="72" height="0" valign="middle" bgcolor="#E6E6E6"><font
color="#000000">姓名:</font></td><td height="20" bgcolor="#E6E6E6">
<%=server.htmlencode(rs("username"))%> </td>
</tr>
<tr>
<td width="72" height="0" valign="middle" bgcolor="#FFFFFF"><font
color="#000000">E-mail</font></td>
<td height="20" bgcolor="#FFFFFF"><%= server.htmlencode(rs("E-mail"))%> </td></tr>
<tr>
<td width="72" height="20" bgcolor="#E6E6E6"><font color="#000000">主
题:</font></td>
<td height="20" bgcolor="#E6E6E6"><%=server.htmlencode(rs("title"))%></td></tr>
<tr style="word-break:break-all">
<td width="72" height="20" bgcolor="#E6E6E6"><font color="#000000">留
言:</font></td>
<td height="20" bgcolor="#E6E6E6"><%= server.htmlencode(rs("content"))%> </td></tr></table><br>
<%
rs.movenext
Loop
rs.Close
Set rs = Nothing
Conn.Close
Set Conn = Nothing
%>
</body>
</html>
...全文
43 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhaoliangpat 2003-10-21
  • 打赏
  • 举报
回复
conn.asp

代码贴出来!!!
avonqin 2003-10-21
  • 打赏
  • 举报
回复
sql = "SELECT * FROM Liuyan ORDER BY id DESC"
rs.open conn,1,1 //。。。。。。。。。。。。。。本行有错。

如果改为 rs.open sql,conn,1,1 还报错的话,请检查:
一、你是否用conn对象来打开数据库的?
二、数据库中是否存在Liuyan这个表?
三、Liuyan表中是否存在id这个字段?
lovehwq21 2003-10-21
  • 打赏
  • 举报
回复
拿着这句
SELECT * FROM Liuyan ORDER BY id DESC
到分析器运行一下,如果对的,那就一定是CONN.ASP里面出错啦
xiaobird1 2003-10-21
  • 打赏
  • 举报
回复
还是那行么?
请帖出出错信息。


jingxiaoping 2003-10-21
  • 打赏
  • 举报
回复
麻烦将CONN.ASP里面的内容贴一下
出现的问题应该是ODBC找不到吧?
wlfsq 2003-10-21
  • 打赏
  • 举报
回复
rs.open(sql),conn,1,1
显示留言内容的时候,直接用while……wend

留言内容
<% while not rs.eof %>
姓名:<%=rs("username")%><br>
email:<%=rs("email")%><br>
主题:<%=rs("title")%><br>
留言:<%=rs("content")%><br>
<hr size=1>
<% rs.movenext %>
<% wend %>
wbqc9912115 2003-10-21
  • 打赏
  • 举报
回复
改过来了。还是不行。
xiaobird1 2003-10-21
  • 打赏
  • 举报
回复
rs.open conn,1,1
-->
rs.open sql,conn,1,1

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧