插入方法這樣怎么不行
public void addGoddess(Goddess g) throws SQLException{
Connection con=ww.getConnection();
String sql="insert into ta1 values (?,?,?,?,?,?,?,?,?,?,?,?)";
? ??
sta=con.prepareStatement(sql);
sta.setInt(1, g.getId());
sta.setString(2, g.getUse_name());
sta.setInt(3, g.getSex());
sta.setInt(4, g.getAge());
sta.setDate(5, new Date(g.getBirthday().getTime()));
sta.setString(6, g.getEmail());
sta.setString(7, g.getMobile());
sta.setString(8, g.getCreate_user());
sta.setDate(9, new Date(g.getCreate_date().getTime()));
sta.setString(10, g.getUpdate_user());
sta.setDate(11, new Date(g.getUpdate_date().getTime()));
sta.setInt(12, g.getIsdel());
sta.executeUpdate(sql);
??
}
2017-06-27
你有代碼嗎
2017-06-26
這是用報(bào)錯(cuò)信息
Exception in thread "main" java.sql.SQLException: 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 '?,?,?,?,?,?,?,?,?,?,?,?)' at line 1