我正在尝试从 java 更新悖论表,但我得到了一个异常
java.sql.SQLException: [Microsoft][ODBC Paradox Driver] 操作必须使用可更新查询。java.sql.SQLException: [Microsoft][ODBC Paradox Driver] 操作必须使用可更新查询。java.sql.SQLException: [Microsoft][ODBC Paradox Driver] 操作必须使用可更新查询。
我正在使用这段代码:
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
try {
Connection paradoxCon = paradox.createConnection();
Results res = new Results();
res.getAll();
if (res.allRes.isEmpty()) {
JOptionPane.showMessageDialog(mainPanel, "There are no Finished or Postponed Games!", "Error", JOptionPane.ERROR_MESSAGE);
} else {
int y = res.allRes.size();
for (int x = 0; x < y; x = x + 1) {
try {
if (res.getAll().get(x).Reversed == 0) {
if (res.getAll().get(x).Status.equals("Fin")) {
String sql = "UPDATE Kvote SET _45_d = '" + res.getAll().get(x).HThome + "', _45_g = '" + res.getAll().get(x).HTaway + "', _90_d= '" + res.getAll().get(x).FThome + "', _90_g = '" + res.getAll().get(x).FTaway + "', Ok='Y' WHERE Kolo = '" + res.getAll().get(x).tRound + "' AND Sifra='" + res.getAll().get(x).TID + "'";
PreparedStatement ps = paradoxCon.prepareStatement(sql);
ps.executeUpdate();
}
if (res.getAll().get(x).Status.equals("Post")) {
String sql = "UPDATE Kvote SET _45_d = '" + res.getAll().get(x).HThome + "', _45_g = '" + res.getAll().get(x).HTaway + "', _90_d= '" + res.getAll().get(x).FThome + "', _90_g = '" + res.getAll().get(x).FTaway + "', Ok='O' WHERE Kolo = '" + res.getAll().get(x).tRound + "' AND Sifra='" + res.getAll().get(x).TID + "'";
PreparedStatement ps = paradoxCon.prepareStatement(sql);
ps.executeUpdate();
}
}
if (res.getAll().get(x).Reversed == 1) {
if (res.getAll().get(x).Status.equals("Fin")) {
String sql = "UPDATE Kvote SET _45_d = '" + res.getAll().get(x).HTaway + "', _45_g = '" + res.getAll().get(x).HThome + "', _90_d= '" + res.getAll().get(x).FTaway + "', _90_g = '" + res.getAll().get(x).FThome + "', Ok='Y' WHERE Kolo = '" + res.getAll().get(x).tRound + "' AND Sifra='" + res.getAll().get(x).TID + "'";
PreparedStatement ps = paradoxCon.prepareStatement(sql);
ps.executeUpdate();
}
if (res.getAll().get(x).Status.equals("Post")) {
String sql = "UPDATE Kvote SET _45_d = '" + res.getAll().get(x).HTaway + "', _45_g = '" + res.getAll().get(x).HThome + "', _90_d= '" + res.getAll().get(x).FTaway + "', _90_g = '" + res.getAll().get(x).FThome + "', Ok='O' WHERE Kolo = '" + res.getAll().get(x).tRound + "' AND Sifra='" + res.getAll().get(x).TID + "'";
PreparedStatement ps = paradoxCon.prepareStatement(sql);
ps.executeUpdate();
}
}
} catch (Exception ex) {
System.out.println(ex);
}
}
}
res.getAll().clear();
} catch (ParseException ex) {
Logger.getLogger(AutoResultsImporterView.class.getName()).log(Level.SEVERE, null, ex);
}
}