【发布时间】:2015-02-11 04:21:32
【问题描述】:
我想从表本身和数据库中删除 JTable 中的 selcetd 行。
这是我的代码:
Object number = jTable1.getValueAt(selectedRow-1, 0);
String sql = "delete from orders where number ="+number;
Statement st = conn.createStatement();
rs = null;
rs = st.executeQuery(sql);
excuteQuery() 运行时出现以下异常:
(java.sql.SQLException) java.sql.SQLException: Can not issue data manipulation statements with executeQuery()
我做错了什么?
【问题讨论】:
-
尝试使用 executeUpdate 方法而不是 executeQuery 方法。
标签: java mysql swing jdbc jtable