[英]Deleting data from table view and from sql
I want to delete the data from table view and from SQL,after i tried almost everything i don't know where the problem is?我想从表视图和 SQL 中删除数据,在我尝试了几乎所有事情之后我不知道问题出在哪里?
public void DeleteButton(ActionEvent event) throws SQLException,
ClassNotFoundException{
String sql = "Delete from Add_NewOrder where No=?";
try{
pst = con.prepareStatement(sql);
pst.setString(1, comboBoxTable.getValue());
int i = pst.executeUpdate();
if(i==1){
Alert alert = new Alert(AlertType.ERROR);
alert.setTitle("Information Dialog");
alert.setHeaderText(null);
alert.setContentText("Te dhenat nuk jane shlyer!");
alert.showAndWait();
loadDataFromDataBase();
clearTextField();
}
}catch(SQLException ex){
Logger.getLogger(AddNewOrderController.class.getName()).log(Level.SEVERE,null,ex);
}
}
Which part isn't working?哪个部分不起作用?
I see lots of problems with your code:我看到你的代码有很多问题:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.