为了账号安全,请及时绑定邮箱和手机立即绑定

怎么一直报Exception in thread "main"

怎么一直报Exception in thread "main"

qq_lol_9 2017-03-24 16:15:11
public void testadd(Test t) throws Exception{ Connection conn= jdbcghy.getConn(); String sql="insert into test(NAME,STATUS,CREATE_TIME)valus(?,?,?)"; PreparedStatement pst= conn.prepareStatement(sql); pst.setString(1, t.getName()); pst.setString(2, t.getStatus()); pst.setDate(3, new Date(t.getCreateTime().getTime())); pst.execute(); }
查看完整描述

2 回答

?
qq_lol_9

TA贡献3条经验 获得超36个赞

还报 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 'valus('6347','0','2017-03-24')' at line 1

查看完整回答
反对 回复 2017-03-24
?
qq_沙漠之花_0

TA贡献1条经验 获得超0个赞

throws Exception 因为你把异常扔出去了!  你在这个testadd(Test t)  方法中 try catch  一下 捕捉一下这个异常 在看看问题是出在什么地方

查看完整回答
反对 回复 2017-03-24
  • qq_lol_9
    qq_lol_9
    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 'valus('6347','0','2017-03-24')' at line 1 还报这个,我照着视频敲的!!
  • 2 回答
  • 0 关注
  • 3816 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信