Mark Mark :
how can i input more than 10 integers in Database when i input more than 10 integers this will appear Number Format Exception: For input string: can everyone help me? this is my code
try {
i = Integer.valueOf(cmb.getText());
String conV = String.valueOf(i);
n = a1.getText();
s = a2.getText();
rs.moveToInsertRow();
rs.updateString("STUDENTNO", conV);
rs.updateString("NAME", n);
rs.updateString("COURSE", s);
rs.insertRow();
Refresh_RS_STMT();
jTable4.clearSelection();
showAll();
JOptionPane.showMessageDialog(this,"Student has been saved!");
} catch (SQLException err) {
JOptionPane.showMessageDialog(this,err);
}
axelclk :
You can try:
i = Integer.valueOf(cmb.getText().trim())
to avoid "whitespaces" by "trimming" your input string.
Or catch the NumberFormatException
which may be thrown in Integer.valueOf()
and show us the exception.
Guess you like
Origin http://43.154.161.224:23101/article/api/json?id=345595&siteId=1