每次执行都报错,提示的错误位置还不一定
for(...){
...
Connection conn = null;
Statement stmt = null;
...
stmt = conn.createStatement();
int n=stmt.executeUpdate("update 表1 set ... where ...");
stmt.executeUpdate("delete from 表2 where...");
stmt.executeUpdate("update 表2,表3 set ... where ...");
stmt.executeUpdate("update 表2 set ... where ...");
while(){
....
rs = stmt.executeQuery(sql.toString());
...
rs = stmt.executeQuery(sql.toString());
...
}
}
1 回答
动漫人物
TA贡献1815条经验 获得超10个赞
Connection 和statement要在for循环之前创建,
如: Connection conn=getConnection();
stmt = conn.createStatement();
for(.......){.................}
添加回答
举报
0/150
提交
取消