如果字符串连接成功的话,还有SQL语句没有错误的话按照下面的修改,我这里已经调试成功了
这样修改
把: Statement stmt=con.prepareStatement("insert into employee(id,name,sex,born,nation,minzu,zhengzhi,marry,school,zhiwei,tel,address) values ('"+snumber+"','"+sname+"','"+ssex+"','"+sbir+"','"+shometown+"','"+snation+"','"+sstatus+"','"+smarrage+"','"+seducation+"','"+sposition+"','"+smobile+"','"+saddress+"')");修改成:Statement stmt = con.createStatement();
stmt.executeQuery("insert into employee(id,name,sex,born,nation,minzu,zhengzhi,marry,school,zhiwei,tel,address) values ('"+snumber+"','"+sname+"','"+ssex+"','"+sbir+"','"+shometown+"','"+snation+"','"+sstatus+"','"+smarrage+"','"+seducation+"','"+sposition+"','"+smobile+"','"+saddress+"')");楼主满意的话记得给我+++++++++++加分+++++++++
HOME_ning(玩物丧志)
这样修改
把: Statement stmt=con.prepareStatement("insert into employee(id,name,sex,born,nation,minzu,zhengzhi,marry,school,zhiwei,tel,address) values ('"+snumber+"','"+sname+"','"+ssex+"','"+sbir+"','"+shometown+"','"+snation+"','"+sstatus+"','"+smarrage+"','"+seducation+"','"+sposition+"','"+smobile+"','"+saddress+"')");修改成:Statement stmt = con.createStatement();
stmt.executeQuery("insert into employee(id,name,sex,born,nation,minzu,zhengzhi,marry,school,zhiwei,tel,address) values ('"+snumber+"','"+sname+"','"+ssex+"','"+sbir+"','"+shometown+"','"+snation+"','"+sstatus+"','"+smarrage+"','"+seducation+"','"+sposition+"','"+smobile+"','"+saddress+"')");楼主满意的话记得给我+++++++++++加分+++++++++
HOME_ning(玩物丧志)
E Code0
E M=Can not issue data manipulation statements with executeQuery().
错
2).mysql的root用户相关问题,类似于此贴:
http://topic.csdn.net/u/20100518/17/03c76fdc-69a6-4b3f-af80-07296ca32443.html
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 'nation,minzu,zhengzhi,marry,school,zhiwei,tel,adress) values (123,as,s,1988-12-1' at line 1