I am trying to update with this code

Result.updateInt("bank_ac_no",Integer.parseInt(acnotxtfield.getText().trim()));
//this is the line I'm getting error.

Here is the Trace

java.lang.NumberFormatException: For input string: "2737383928291819"
    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
    at java.lang.Integer.parseInt(Integer.java:495)
    at java.lang.Integer.parseInt(Integer.java:527)

What's wrong?

Recommended Answers

All 4 Replies

Did you try catching the NumberFormatException?

Yes

 catch (SQLException | NumberFormatException e) 
          {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

Looks to me like that value is a valid integer, but its not a valid int because it's too big, >= 2^32. You could use a long instead of an int.

Do I have to change the Data type also for the column?Because

Result.updateLong("bank_ac_no",Integer.parseInt(acnotxtfield.getText().trim()));

updateLong instead of Int did not worked ,gave me the same error.

EDIT:I think I have also to change Long.parseLong :) It will work then .

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.