我无法在数据库中搜索记录,当我写文件到TextField
TableModel
正在加载但不在数据库中搜索时,表格是明确的。
private void jTextField1KeyReleased(java.awt.event.KeyEvent evt) {
jTabbedPane1.setSelectedIndex(2);
try {
File currDir= new File ("Baza.db");
String sc = currDir.getAbsolutePath();
sc = sc.substring(0, sc.length());
String url = "jdbc:sqlite://"+sc;
Connection conn = DriverManager.getConnection(url);
String wyszukaj =" SELECT * FROM WydatkiStale WHERE id_WydatekStaly =?";
PreparedStatement pst = conn.prepareStatement(wyszukaj);
pst.setString(1,"value");
ResultSet rs = pst.executeQuery();
jTable3.setModel(DbUtils.resultSetToTableModel(rs));
} catch (SQLException e) {
JOptionPane.showMessageDialog(null, e);
}
}
答案 0 :(得分:0)
问题很可能在这里:
java.awt.event.KeyEvent evt
您在每个数据库查询中使用硬编码值,但您应该使用TextField
或=IF(ISBLANK(G2),"",TODAY()-G2)
内容中的动态获取值