由于您正在使用PreparedStatement
,因此可以致电executeUpdate()
-
int count = stmt.executeUpdate();
action = (count > 0); // <-- something like this.
通过上面的Javadoc( Return )链接,添加了重点,
(1) sql数据操作语言 (DML)语句 的 ,_或者(2)0不返回任何内容的sql语句 _的 _ _ 。
如果您要插入大量条目,我更喜欢addBatch()
和executeBatch()
。