我有一个JTextArea的问题...我有一个方法通过数据库管理器连接到数据库并获得带有结果集的哈希表.之后我在控制台中打印了这些值.现在我必须将控制台更改为JTextArea.这是我班上的一个方法:
public void viewSystemProperties(){
PropertiesDTO pdto = new PropertiesDTO();
PropertiesManager pMng = new PropertiesDBmanager();
pdto.setPropDTO(pMng.getProperties().getPropDTO());
Iterator<String> it = pdto.getPropDTO().keySet().iterator();
String key = null, value = null;
System.out.println("\t\t**************************");
System.out.println("\t\t* PROPERTY TABLE: *");
System.out.println("\t\t**************************\n");
while (it.hasNext()){
key = (String)it.next();
value = pdto.getPropDTO().get(key);
System.out.println(" " + key + "\t-------------------\t
["+value+"]\n");
}// while
}// viewSystemProperties()
Run Code Online (Sandbox Code Playgroud)
它必须在JTextArea中打印而不是System.out.println ...感谢您的帮助.
我准备好的声明中有一个长号问题.这是代码:
String removeCltQry = "DELETE * FROM Clients WHERE client_id = ?";
long client_id = 10;
Connection con = null;
PreparedStatement pstm = null;
try {
con = DBMngerST.instance().getDBCon();
pstm = con.prepareStatement(removeCltQry);
pstm.setLong(1, client_id);
pstm.executeUpdate();
pstm.close();
} catch (SQLException e) {
e.printStackTrace();
} finally {
if (con != null) {
try {
con.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
Run Code Online (Sandbox Code Playgroud)
这是堆栈跟踪:
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver]Optional feature not implemented
at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.SQLBindInParameterBigint(Unknown Source) …Run Code Online (Sandbox Code Playgroud)