String sql = "select id,user_name from t_user t where t.user_name= ? and t.password= ? ";
conn = connectionManager.getConnection();
PreparedStatement pstmt = conn.prepareStatement(sql);
pstmt.setString(1,"xiao");
pstmt.setString(2,"123456");
rs = pstmt.executeQuery(sql);
运行后提示下面的错
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 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 '? and t.password= ?' at line 1Mysql是5.0的
Mysql jar是mysql-connector-java-5.1.13-bin
请教高手啊
conn = connectionManager.getConnection();
PreparedStatement pstmt = conn.prepareStatement(sql);
pstmt.setString(1,"xiao");
pstmt.setString(2,"123456");
rs = pstmt.executeQuery(sql);
运行后提示下面的错
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 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 '? and t.password= ?' at line 1Mysql是5.0的
Mysql jar是mysql-connector-java-5.1.13-bin
请教高手啊
解决方案 »
- java如何获得其它程序句柄
- validator-rules 的添加 高手请进~ 急!
- 请教如何调试这种Java程序
- 怎么样理解工程模式,内部类,匿名类等?
- Applet 在JDK哪个版本下编译,不用装JDK,IE保证能运行?
- 请问如何触发JTextArea中的选中事件
- 从哪可以下载关于JAVA类(例如:JAVA.IO.*)的说明啊
- 我真想给你们1000分,可是我只能分批发送了。
- 想让JLabel显示的字是从上到下的。该怎么办?
- 刚学习Java,请教关于Java的Application代码编写问题。
- JDK1.6注解 @Test @SuppressWarings 都找不到符号
- 3秒后返回,js代码
conn.prepareStatement(sql);
pstmt.executeQuery(sql);---》pstmt.executeQuery();