关键字 'current_date' 附近有语法错误。
运行后代码显示出
Exception in thread "main" com.microsoft.sqlserver.jdbc.SQLServerException: 关键字 'current_date' 附近有语法错误。
public class GoddessDao { public void addGoddess(Goddess g) throws SQLException { Connection conn=DBUtil.getConnection(); String sql=""+"insert into imooc_goddess"+"(use_name,sex,age,birthday,email,mobile,"+ "create_user,create_date,update_user,update_user,update_date,isdel)"+ "values("+"?,?,?,?,?,?,?,current_date(),?,current_date(),?)"; PreparedStatement ptmt=conn.prepareStatement(sql); ptmt.setString(1, g.getUser_name()); ptmt.setInt(2, g.getSex()); ptmt.setInt(3,g.getAge()); ptmt.setDate(4,new Date(g.getBirthday().getTime())); ptmt.setString(5,g.getEmail()); ptmt.setString(6,g.getMobile()); ptmt.setString(7,g.getCreate_user()); ptmt.setString(8,g.getUpdate_user()); ptmt.setInt(9,g.getIsdel()); ptmt.execute(); } public class GoddessAction { public static void main(String[] args) throws Exception { GoddessDao g=new GoddessDao(); Goddess g1=new Goddess(); g1.setUser_name("小夏"); g1.setAge(22); g1.setSex(1); g1.setBirthday(new Date()); g1.setEmail("xiaoxia@imooc.com"); g1.setMobile("18766888866"); g1.setCreate_user("ADMIN"); g1.setUpdate_user("ADMIN"); g1.setIsdel(1); g.addGoddess(g1); } }
这个问题怎么解决啊