报错提示:
com.mysql.jdbc.exceptions.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.colpas=?' at line 1
插入一条记录可以实现,就是取数出现了问题
把 ResultSet rs = ps.executeQuery(sql); 改为 ResultSet rs = ps.executeQuery();
executeQuery如果带了参数,那么前面设置的setString就没用了,所以传给mysql的句子是带问号的,无法被识别