Responsive Ad Area

Share This Post


How to fix NumberFormatException?

SimpleDateFormat sdf = new SimpleDateFormat(“yyyyMMdd”);
String selectQueryForPatient = “SELECT registration_id, dob FROM patient_registration WHERE registration_id IN(SELECT max(registration_id)FROM patient_registration)”;

    String insertQuery = "INSERT INTO patient_master_info(patient_id) VALUES (?);";
    String id = null;
    String dob = null;
    int generatedID = 0;
    try {
        pst = con.prepareStatement(selectQueryForPatient);
        rs = pst.executeQuery();
           id = Integer.toString(rs.getInt(1));
           dob = rs.getString(2);
           System.out.println("Id : "+id+" "+"DOB: "+dob);
           Date dt = sdf.parse(dob);
           dob = sdf.format(dt);
           String result = id.concat(dob);
           generatedID = Integer.parseInt(result);

        pst = con.prepareStatement(insertQuery);
        pst.setInt(1, generatedID);
    } catch (Exception e) {

How to fix NumberFormatException?
How to fix NumberFormatException?

Share This Post

Leave a Reply

Your email address will not be Publishedd. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Skip to toolbar