大家好, 这是我的代码,Update语句
public static boolean updateDB() {
Connection cn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
boolean result = false;
int number;
String insetSQL ="update quan set ten_quan='lin' where id=1";
try {
cn = LocalDatabasePooling.getInstance().getConnection();
pstmt = cn.prepareStatement(insetSQL);
pstmt.executeUpdate();
result = true;
} catch (SQLException e) {
e.printStackTrace();
} finally {
if (rs != null) {
try {
rs.close();
} catch (SQLException sqle) { }
}
if (pstmt != null) {
try {
pstmt.close();
}
catch (SQLException sqle) { }
}
if (cn1 != null) {
try {
cn1.close();
}
catch (SQLException sqle) { }
}
}
return false;
}
上面是正确的代码?但是当我调试时,我看到线
number = pstmt.executeUpdate();
没有被执行,它下面的代码也没有执行太多。
当我添加看
pstmt.executeUpdate();
我看到这个信息
错误(评估
什么是错的过程?
你为什么要改变/修复的问题的代码不留在我的答案反馈?现在我的回答对没有读过原始问题的人来说是没有意义的。 – BalusC