代码是在JAVA中执行SQL语句 数据库是MYSQL
String sql= "select member_id.mem_id,member_id.name,member_id.given_date,IDcard.sex,IDcard.nation,IDcard.birth_date,IDcard.address,IDcard.id,IDcard.valid_date"+ "from member_id,IDcard where (id="
+ "\"" + Member_id.getText() + "\""+" and member_id.name=idcard.name);";
其中Member_id.getText()是输入的字符串
为什么总是显示 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 'where (id="220182" and member_id.name=idcard.name)' at line 1
错误
麻烦看一下 如果能给出好点的SQL语句就更好了
------解决方案--------------------
id 是不用加引号的,字符串才要加引号,Member_id.getText()是字符串,你可以将它转为int
Integer.parse(Member_id.getText());