@FXML private TextField currentAdd;
@FXML private TextField newAdd;
@FXML private TextField currentMail;
@FXML private TextField newMail;
@FXML
public void editDetails(ActionEvent event){
try {
if (currentAdd.getText().equals("") || newAdd.getText().equals("")) {
String qr = "update customer set c_mail='" + newMail.getText() + "' where c_mail='" + currentMail.getText() + "'";
rs = st.executeQuery(qr);
} else {
String qr = "update customer set c_address='" + newAdd.getText() + "',c_mail='" + newMail.getText() + "' where c_mail='" + currentMail.getText() + "'";
rs = st.executeQuery(qr);
}
}
catch (Exception e) {
System.out.println(e);
}
我从中得到空异常。我想看看TextField是否为空,如果它为空,我想写我的if条件以将数据发送到数据库