出错啦,高手帮帮忙

gao123456789amy 2012-05-09 04:54:02
<!-- #include file="Show.asp" -->
<%
'=============连接数据库===============
Set Conn=Server.CreateObject("ADODB.Connection")
Conn.ConnectionString="driver={SQL Server};server=LENOVO-

PC;UID=sa;PWD=;Database=Discuss"
Conn.Open
'============从表Content中读取用户数据==============
Set rs=Server.CreateObject("ADODB.Recordset")
Set rs.ActiveConnection = Conn
rs.CursorType = 3
flag=request.querystring("flag")
cid=request.querystring("id")
if flag=1 then
'打开记录集
rs.Open "SELECT * FROM Content WHERE UpperId=0 ORDER BY IsTop ASC, LastAnswerTime
DESC"
else
rs.Open "SELECT * FROM Content WHERE UpperId=0 and CateId=" & cid & "ORDER BY IsTop
ASC, LastAnswerTime DESC "
end if
'设置每页记录数
rs.PageSize = 5
'读取参数Page,表示当前的页码
Page = CLng(Request("Page"))
'处理不合法的页码
If Page < 1 Then Page = 1
If Page > rs.PageCount Then Page = rs.PageCount
%>
<html>
<head>
<!--
.main { font-size: 9pt }
-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<title>全部帖子</title>
<style>
<!--
.main { font-size: 10pt }
-->
</style>
</head>
<body topmargin="0" background="images/Back.jpg" vlink="#000000" link="#000000">
<a name="top"></a>
<div align="center">
<center>
<h2>全部帖子</h2>
<table width="714" border="0" height="218" cellspacing="0" cellpadding="0">
<tr> <td height="18" class="main"> <% Call ShowPage( rs, Page ) %></td></tr>
<tr> <td height="21" class="main"> <% Call ShowList( rs, Page ) %> </td></tr>
<tr><td height="15" class="main" ><p align=right><a href="#top">返回顶部

</a>  <a href="index.asp">返回首页</a></td></tr>
<tr> <td height="15"> </td></tr>
</table>
</body>
</html>
Microsoft OLE DB Provider for ODBC Drivers '80040e14'

[Microsoft][ODBC SQL Server Driver][SQL Server]在关键字 'ORDER' 附近有语法错误。

\artlist.asp, line 18


请大家帮个忙,我才刚学
...全文
92 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
never exists 2012-05-10
  • 打赏
  • 举报
回复
"ORDER 引号后面空格额
snlixing 2012-05-10
  • 打赏
  • 举报
回复
SELECT * FROM Content WHERE UpperId=0 and CateId=" & cid & " ORDER BY IsTop ASC, LastAnswerTime DESC
gao123456789amy 2012-05-09
  • 打赏
  • 举报
回复
是这个意思吗,我把你写的这句话写在"SELECT * FROM Content WHERE UpperId=0 and CateId=" & cid & "ORDER BY IsTop ASC, LastAnswerTime DESC "的上面,然后结果是:
Microsoft VBScript 编译器错误 '800a0409'

未结束的字符串常量

\artlist.asp, line 18
gao123456789amy 2012-05-09
  • 打赏
  • 举报
回复
什么意思,没看懂,在哪句话上面
LittleMo_2012 2012-05-09
  • 打赏
  • 举报
回复
"SELECT * FROM Content WHERE UpperId=0 and CateId=" & cid & "ORDER BY IsTop
ASC, LastAnswerTime DESC "

在这句话上面,打印出来,再发上来
response.write("SELECT * FROM Content WHERE UpperId=0 and CateId=" & cid & "ORDER BY IsTop
ASC, LastAnswerTime DESC ")
response.end
gao123456789amy 2012-05-09
  • 打赏
  • 举报
回复
还是不对啊
三石-gary 2012-05-09
  • 打赏
  • 举报
回复
"SELECT * FROM Content WHERE UpperId=0 and CateId=" & cid & "ORDER BY IsTop
ASC, LastAnswerTime DESC "

应该是你这段字符串的问题。。
"SELECT * FROM Content WHERE UpperId=0 and CateId=& cid & ORDER BY IsTop
ASC, LastAnswerTime DESC "
这样试试?

28,391

社区成员

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

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