I need help with this code. I kept having this kind of error but I don’t know the reason.
<code> String nam = name.getText();
String number = num.getText();
String pass = password.getText();
String mail = email.getText();
try{
Statement s = db.mycon().createStatement();
s.executeUpdate("INSERT INTO user (full_name, phone_number, password, email) VALUES ('"+nam+"','"+number+"','"+pass+"','"+mail+"')");
Success SuccessFrame = new Success();
SuccessFrame.setVisible(true);
SuccessFrame.pack();
SuccessFrame.setLocationRelativeTo(null);
this.dispose();
} catch (Exception e){
System.out.println(e);
}
name.setText("");
num.setText("");
password.setText("");
email.setText("");
</code>
<code> String nam = name.getText();
String number = num.getText();
String pass = password.getText();
String mail = email.getText();
try{
Statement s = db.mycon().createStatement();
s.executeUpdate("INSERT INTO user (full_name, phone_number, password, email) VALUES ('"+nam+"','"+number+"','"+pass+"','"+mail+"')");
Success SuccessFrame = new Success();
SuccessFrame.setVisible(true);
SuccessFrame.pack();
SuccessFrame.setLocationRelativeTo(null);
this.dispose();
} catch (Exception e){
System.out.println(e);
}
name.setText("");
num.setText("");
password.setText("");
email.setText("");
</code>
String nam = name.getText();
String number = num.getText();
String pass = password.getText();
String mail = email.getText();
try{
Statement s = db.mycon().createStatement();
s.executeUpdate("INSERT INTO user (full_name, phone_number, password, email) VALUES ('"+nam+"','"+number+"','"+pass+"','"+mail+"')");
Success SuccessFrame = new Success();
SuccessFrame.setVisible(true);
SuccessFrame.pack();
SuccessFrame.setLocationRelativeTo(null);
this.dispose();
} catch (Exception e){
System.out.println(e);
}
name.setText("");
num.setText("");
password.setText("");
email.setText("");
I don’t see anymore mistakes in my value of column but still I get this error whenever I run the program.
Help me to resolve this problem please.
New contributor
Dave Franc Vergara is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.