分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.csdn.net/jiangjunshow
也欢迎大家转载本篇文章。分享知识,造福人民,实现我们中华民族伟大复兴!
今下午一连遇到了俩错误, 都是比较低级的
只能说是基础不到家, 唉。。。。。。。。。。
- String psql = "select * from users where id = ?";
- pstmt = conn.prepareStatement(psql);
- pstmt.setInt(1, id);
- ResultSet rs = pstmt.executeQuery(psql);
ResultSet rs = pstmt.executeQuery(psql); 运行【完】这的时候 会抛出一个异常:
com.mysql.jdbc.exceptions.MySQLSyntaxErrorException:
You have an error in your SQL syntax;
check the manual that corresponds to your MySQL server version for theright syntax to use near '?' at line 1
============================================
在解决问题的时候 一直围绕着 “参数”-- ? --求解,但是。。。。
没有留意 executeQuery () 的用法
executeQuery 一个是不带参数的, 另一个是带参数的:
二者之间的区别
executeQuery () 是 pstmt 中的方法
而executeQuery (sql) 是继承自stmt中的方法
=============================================