executeUpdate(sql)这条语句为啥总不执行呢?求教
我的代码:
String sql = "UPDATE ACCOUNTS SET 密码=" + account.getPassword()
+ " WHERE 账户名=" + account.getAccountName();
try {
Class.forName(this.dbDriver).newInstance();
} catch (Exception e) {
e.printStackTrace();
}
try {
Connection conn = DriverManager.getConnection(this.dbUrl,
this.user, this.password);
if (!conn.isClosed()) {
Statement st = conn.createStatement();
Account acc = this.getAccountInfo(account.getAccountName());
if (acc != null) {
System.out.println(2);
int count = st.executeUpdate(sql);
System.out
.println(count
+ " account's information has been updated in table ACCOUNTS!");
} else
System.out
.println("There isn't the account which you want to update its information!");
}
} catch (SQLException e) {
}