0
    private void search_fKeyReleased(java.awt.event.KeyEvent evt) {                                     
    try {

is ther something wrong here

        PreparedStatement pst =null;
        ResultSet rst=(ResultSet) pst;
        Connection con=(Connection)  
        DriverManager.getConnection("jdbc:mysql://localhost/iqari", 
        "root","");


        String sql="select * from first where  masaha_iqar=?";
        pst=(PreparedStatement) con.prepareStatement(sql);
        pst.setString(1,search_f.getText());
        rst=pst.executeQuery();

in the text area i get on result instead of two available in my database

        if (rst.next()){String add1=rst.getString("raqm_iqar");
        jTextArea2.append(add1 + "\n");

        System.out.format("%s",add1);
        }

    } catch (Exception e) {
    }
  TODO add your handling code here:
}
ehab
  • 129
  • 1
  • 9

1 Answers1

0
try {
    PreparedStatement pst =null;
    ResultSet rst=(ResultSet) pst;

    Connection con=(Connection)    DriverManager.getConnection("jdbc:mysql://localhost/iqari", "root","");
    String sql="select * from first where  masaha_iqar=?";
    pst=(PreparedStatement) con.prepareStatement(sql);
    pst.setString(1,search_f.getText());
    rst=pst.executeQuery();
   while (rst.next()){String add1=rst.getString("raqm_iqar");
    jTextArea2.append(add1 + "\n");
    System.out.format("%s",add1);
    }

} catch (Exception e) {
}
javaDeveloper
  • 1,403
  • 3
  • 28
  • 42