sql语句问题~~~
<%@ page contentType= "text/html; charset=gb2312 " language= "java " import= "java.sql.* "
errorPage= " " %>
<%@ include file= "../incoming/connDB.jsp "%>
<html>
<head> </head>
<body>
<%
//数据库连接
int curpage=0;//当前页
int page_record=20;//每页显示的记录数
//curpage=Integer.parseInt(request.getParameter( "page "));//获取传递的值,需要显示的页
smt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
//Statement smt_fy=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
//smt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
//ResultSet rs_fy=smt_fy.executeQuery( "select count(*) from message ");
sql = "select * from message order by 'id ' desc limit "+ curpage + ", "+ page_record;
rs=smt.executeQuery( sql);
//本查询语句得到的是所要显示的1000页的20条记录,大致思路为——子查询排除
//需要显示的记录前的所有记录,父查询则对余下的记录进行降序排列
while(rs.next()) {
%>
<table width= "75% " border= "1 " align= "center " cellpadding= "0 " cellspacing= "0 ">
<tr>
<td> <div align= "center "> 标题: <%=rs.getString( "title ")%> </div> </td>
</tr>
<tr>
<td> <div align= "center "> </div> </td>
</tr>
<tr>
<td> <hr width= "85% "> </td>
</tr>
</table>
<%}
rs.close();
%>
//下面是 第几页等 </p>
</body>
</html>
错误提示:
javax.servlet.ServletException: [Microsoft][ODBC Microsoft Access Driver] ORDER BY 子句语法错误。
------解决方案--------------------sql写错了吧,打印一下是什么?
------解决方案--------------------order by 'id ' 这儿加单引号什么意思,去掉试试