1

warning image

i keep getting this message in netbeans while doin project for collage

how to fix it?

try{
            stmt = conn.createStatement();
            
            int stdId = Integer.parseInt(id.getText());
            
            String sql = "SELECT * FROM STUDENT TABLE WHERE id ='"+stdId+"' ";
            
            rs = stmt.executeQuery(sql);
            
            if(rs.next()){
                
                name.setText(rs.getString("stdName"));
                FatherName.setText(rs.getString("stdFatherName"));
                City.setText(rs.getString("stdCity"));
                blood.setText(rs.getString("stdBlood"));
                phone.setText(rs.getString("stdPhone"));
                stdkelas.setText(String.format("%s",rs.getInt("Class")));
                
            }else{
                JOptionPane.showMessageDialog(null,"Record Not Found");
            }
        }catch(HeadlessException | NumberFormatException | SQLException e){JOptionPane.showMessageDialog(null,e);}

i tried to found and solution and i expect people will help

  • 1
    Welcome to Stack Overflow. Is ```id``` an integer? Why is there the reserved word ```TABLE```? – ewokx Apr 17 '23 at 01:22
  • 1
    You should also be making use of [`PreparedStatement`](https://docs.oracle.com/javase/tutorial/jdbc/basics/prepared.html) – MadProgrammer Apr 17 '23 at 01:25
  • 1
    [Please do not upload images of code/data/errors.](//meta.stackoverflow.com/q/285551) – Sören Apr 17 '23 at 01:36

0 Answers0