在jsp中,用mysql查询报版本错误
这是我报错的代码:
String strId = request.getParameter("id");
if(strId == null || strId.trim().equals("")){
out.println("Error ID");
return;
}
int id = Integer.parseInt(strId);
System.out.println("Id" + id );
Connection conn = DB.getConn();
String sql = "select * from article where rootid = " + strId + "order by pdate asc"; //报错的主题行
Statement stmt = DB.createStmt(conn);
ResultSet rs = DB.executeQuery(stmt,sql);
List <Article> articles= new ArrayList <Article>();
while(rs.next()){
Article a = new Article();
a.initfromRs(rs);
articles.add(a);
}
报错的错是: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'by pdate asc' at line 1
我再网上查了一下,没有看到一个合适我这问题的答案,有的好像说是什么mysql版本问题。以前也遇到过类似的问题
相关问答:
我现在想用ssh整合来做一个论坛,但数据库方面不行,我主要不会涉及数据库,不知道发帖表,和回帖表要如何设计和区分。不知道谁有一个简单的思路,来设计这些表。谢谢了。
发帖和回帖用同一张表 。发帖 id user ......
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jas ......
//用客户的session的id建立一个临时文件:
//String tempFileName=(String)session.getId();
String tempFileName = (String)session.getId();
//out.println(& ......
问题描述:
例如我要显示的内容如下所示
一级目录1
一级目录1子类1
子类1
一级目录1子类2
......
问题是这样的:
我有一个文件nagiv.jsp 另一个文件failure.jsp包含他,同时nagiv文件中有一个可以跳转到yy.jsp的commandButton,但是我将failure中点击nagiv中的哪个commandButton,也面不会跳转 ......