0

我正在尝试寻找一张桌子。当我在列名 men 中搜索名称时,当我运行程序并 fx 在搜索框中搜索 babar 时,程序说列名不存在

try {     
    //        Class.forName("oracle.jdbc.driver.OracleDriver");
            String URL = "jdbc:derby://localhost:1527/BOBSHOP";
            String Username = "babar";`enter code here`
            String Password = "babar";
            String DB_DRIVER = "oracle.jdbc.driver.OracleDriver";
            Connection con2 = DriverManager.getConnection(URL, Username, Password);

            //String sql = "Select * FROM \"Kundetabel\" WHERE navn =?";
            //String sql = "select * from BABAR.\"Kundetabel\" WHERE navn=?";
            String sql = "SELECT * FROM \"Kundetabel\" WHERE navn LIKE '%navn%'";

            pst = con2.prepareStatement(sql);
            pst.setString(1,sogeTextField1.getText());

            String sognavn = sogeTextField1.getText();

            rs=pst.executeQuery();
            if(rs.next()){
            String add1=rs.getString("kundeID");
            sogedisplayTextField1.setText(add1);
            String add2=rs.getString("navn");
            sogedisplayTextField2.setText(add2);
            String add3=rs.getString("efternavn");
            sogedisplayTextField3.setText(add3);
            String add4=rs.getString("adresse");
            sogedisplayTextField4.setText(add4);
            String add5=rs.getString("email");
            sogedisplayTextField5.setText(add5);
            String add6=rs.getString("telefonnr");
            sogedisplayTextField6.setText(add6);
            String add7=rs.getString("kode");
            sogedisplayTextField7.setText(add7);
            }
        } catch (SQLException ex) {
            Logger.getLogger(HardwareStore.class.getName()).log(Level.SEVERE, null, ex);
        }       
4

0 回答 0