0
我需要制作一个Jar来从Access数据库中格式化电子表格,并使用UcanAccess进行此操作,所有查询都可以正常工作,直到我需要使用格式化的phonenumbers。UcanAccess ::: 4.0.2意外的令牌:164更新查询
public void updatePhonenumberColumn()
{
try {
for (int i = 0; i < this.phoneNumbers.size(); i++) {
String SQL = "UPDATE [" + this.table + "] SET [" + this.phonenumberColumn + "]=" + this.phoneNumbers.get(i) + " WHERE [" + this.id + "]=" + i;
PreparedStatement preparedStatement = connection.prepareStatement(SQL);
preparedStatement.executeUpdate();
}
} catch (SQLException e) {
System.err.println(e.getMessage() + "\nErrorcode: " + e.getErrorCode());
}
}
我一直在使用括号作为其他职位建议试过了,格式化PHONENUMBERS存储在由自己一个ArrayList,然后我尝试使用更新语句添加。如果不清楚,我会尽力提供更多信息。
我已经尝试过使用ResultSet.next(),并注意到while循环立即留下,就好像ResultSet将是空的,这是不可能的,因为我之前使用完全相同的代码将phonenumbers附加到我的ArrayList中。
public void updatePhonenumberColumn()
{
String sql = "SELECT " + this.phonenumberColumn + " FROM " + this.table;
try {
Statement statement = connection.createStatement();
this.resultSet = statement.executeQuery(sql);
System.out.println(this.resultSet.getFetchSize());
} catch (SQLException e) {
System.err.println(e.getMessage() + "\nErrorcode: " + e.getErrorCode());
}
}
低于早前的查询来获得PHONENUMBERS了Access数据库
public void executeQueryPhoneNumber(String tableName, String columnName)
{
this.actualColumn = columnName;
this.phonenumberColumn = columnName;
this.table = tableName;
try {
this.query = this.connection.createStatement();
this.resultSet = query.executeQuery("SELECT " + this.phonenumberColumn + " FROM " + this.table);
appendItems(this.phoneNumbers, this.resultSet);
} catch (SQLException e) {
System.err.println(e.getMessage() + "\nErrorCode: " + e.getErrorCode());
}
}
我将不胜感激任何想法非常多的