【发布时间】:2014-04-11 18:28:59
【问题描述】:
以下 jdbc 代码给出错误MySQLSyntaxErrorException: You have an error in your SQL syntax;。帮我找到它。
String selectqry="select * from raildb"+ "WHERE id=?";
Class.forName("com.mysql.jdbc.Driver");
Connection con=DriverManager.getConnection(host,uName,uPass);
ps1=con.prepareStatement(selectqry);
ps1.setInt(1,MyModel.idno);
ResultSet rs=ps1.executeQuery();
【问题讨论】:
-
如果你已经阅读了异常中的错误信息,那就很明显了。
-
根本不明白为什么需要连接 2 个字符串 ...