1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| public String getValueAt(TableView<Note> table, int column, int row) {
return table.getColumns().get(column).getCellObservableValue(row).getValue().toString();
}
@FXML
void updateData(ActionEvent event) throws ClassNotFoundException, SQLException {
String sql = "UPDATE NOTES set note = '"+getValueAt(tableView,2,0)+"', coef = '"+getValueAt(tableView,3,0)+"', total = '"+getValueAt(tableView,4,0)+"', appreciation = '"+getValueAt(tableView,5,0)+"' where noteMatri = '"+getValueAt(tableView,0,0)+"';" ;
Connection con = FirstConnection.Connect();
Statement pst = con.createStatement();
String e = getValueAt(tableView,0,0);
System.out.println(e);
String f = getValueAt(tableView,1,0);
System.out.println(f);
String a = getValueAt(tableView,2,0);
System.out.println(a);
String b = getValueAt(tableView,3,0);
System.out.println(b);
String c = getValueAt(tableView,4,0);
System.out.println(c);
String d = getValueAt(tableView,5,0);
System.out.println(d);
int i = pst.executeUpdate(sql);
if(i == 1){
Alert alert = new Alert(AlertType.INFORMATION);
alert.setTitle("Mise � jour effectu�e");
alert.setHeaderText("Enregistrement d'�l�ments");
alert.showAndWait();
}
} |
Partager