Question 1:
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 ...
通常遇到这种问题的原因在于:sql语句写错
我当时是因为在java中delete * from 表 where .... 这句sql语句不能加*
而在select中却需要加*
Qusetion 2:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column
…… 出现这个异常的很大可能性是
数据库是没有问题的!关键原因是:你从传过来的参数是String类型的,我们在操作数据库时String类型的参数必须要用' '把参数引起来才能传递并接
收!
例如rs=stmt.executeQuery("select * from userinfo where userid = '"+ID+"'");ID是String类型,在进行数据库操作时,千万不要漏了两边的单引号,切记 !!!常错点!!!