I am a beginner trying to make checkboxes in a JavaFX app, can someone please tell me how do I connect to my database this checkbox method :
@FXML
private void handleOptions(ActionEvent e){
String message= "";
if(checkFc.isSelected()){
message += checkFc.getText();
return;
}
i want to apply the value of the checkbox into this method :
public void addUsers (){
conn = mysqlconnect.ConnectDb();
String sql = "insert into users (username,password,email,fc)values(?,?,?,? )";
try {
pst = conn.prepareStatement(sql);
pst.setString(1, txtUsername.getText());
pst.setString(2, txtPassword.getText());
pst.setString(3, txtEmail.getText());
pst.setString(4, checkFc.getText());
the getText method, though it works, it gets the value regardless if the checkbox is checked or not, while calling for the handleOptions method, I get cannot resolve method, which makes sense since these are prepared statements, so is there a way to make my method a preparedStatement or maybe I can connect my method another way altogether, please I really need help on this one.
Aucun commentaire:
Enregistrer un commentaire