关于操作数据库!

vagrant2008 2004-08-23 09:44:56
Connection con = new Connection();
Statement stmt = con.createStatement();

int i = stmt.executeUpdate("delete from tableName");

请问stmt.executeUpdate("delete from tableName")的返回值有几种情况阿?分别是什么?
谢谢!!
...全文
106 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
vagrant2008 2004-08-23
  • 打赏
  • 举报
回复
谢谢大家
little06 2004-08-23
  • 打赏
  • 举报
回复
stmt.executeUpdate("delete from tableName");
这个语句是没有返回值的

如果你想得到删除的记录数
在执行完上面的语句后
可以用select @@rowcount来得到
黑马 2004-08-23
  • 打赏
  • 举报
回复
public int executeUpdate(String sql)
throws SQLExceptionExecutes

the given SQL statement, which may be an INSERT, UPDATE, or DELETE statement or an SQL statement that returns nothing, such as an SQL DDL statement.

81,094

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧