不断收到警告 java.sql.SQLSyntaxErrorException

问题描述 投票:0回答:0

warning image

我在做拼贴项目时一直在 netbeans 中收到此消息

如何解决?

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);}

我试图找到解决方案,我希望人们会提供帮助

java mysql database netbeans mariadb
© www.soinside.com 2019 - 2024. All rights reserved.