how to set values from database into the textfield
<pre><code> private void btgetinvActionPerformed(java.awt.event.ActionEvent evt) {
        //JOptionPane.showMessageDialog(null, "REMITTANCE ID IS VALID!");
        try {
            DBUtil util = new DBUtil();
            Connection con = util.getConnection();
            PreparedStatement stmt = con.prepareStatement("select bk_det.rm_id from bk_det WHERE dbo.bk_det.rm_id = ?");
            ResultSet rs;
            String rm = tf_rmid.getText().trim();
            stmt.setInt(1, Integer.parseInt(rm));
            rs = stmt.executeQuery();
            while (rs.next()) {
                int i = Integer.parseInt(rs.getString("box_no"));
                tfbrname.setText(rs.getString(i));
            }
        } catch (Exception ex) {
            JOptionPane.showMessageDialog(null, ex.getMessage());

        }
    }
</code></pre>

<p>I am actually trying to search value from my database table called dbo.bk_det. I am taking the value of WHERE from my textfield tf_rmid. Everything goes on well without error but once i insert the rm_id and click on button btgetinv it says 123 which is my rm_id is out of range cant understand where the error is and what is the problem.</p>
