如何修复“找不到符号-方法java.lang.String

时间:2019-05-28 17:17:50

标签: java bluej

我正在尝试使此代码允许我更新访问数据库中的字段,但它不断弹出“找不到符号-方法upDateChesney(java.lang.String,java.lang.String,java.lang.String ,java.lang.String

我试图重命名数据库处理程序,但是我没有运气

         private void upDateFireplacesTable()
         {
             //Defining variables
             int code;


             //upDate Fireplaces will return a -1 if there is a problem
             code = DataBaseHandler.upDateChesney(ID, title, Supplier,price);

             //Check to see what code it contains
             if (code == -1) //Problem report an error
             {
                 JOptionPane.showMessageDialog (frame, "Problem updating record");
             }

             //if the update is successfull then the update method will return 1
             //(the total number of records updated)
             //which would always be 1 since I can only update one record at a time
             else if (code == 1)
             {
                 JOptionPane.showMessageDialog (frame, "Record successfully updated");
             }

//下面的是数据库处理程序代码

      static public int upDateFireplacesTable(String oldIDIn, String newIDIn,String titleIn,String SupplierIn, String priceIn)          
      {
               int code;  // This will hold the number of records affected by the
                          // executeUpDate() method which is used here to UPDATE

               // Build the SQL UPDATE string which involves updating a BOOK record
               String SQLString = "UPDATE FIREPLACES SET ID = '" + newIDIn + "', Title = '" + titleIn               
                                    + "', Supplier = '" + SupplierIn + "', price = " + priceIn +
                                    " WHERE ID = '" + oldIDIn + "'";

               // Update BOOK table
               try
               {
                    // The createStatement() method creates a Statement object.  
                    statement = ConnectionToChesneyDB.createStatement();

                    // executeUpdate() returns the number of records
                    // affected, in this case it will always be either 0 or
                    // 1 (since each book's isbn is unique)
                    code = statement.executeUpdate (SQLString);

                }
              catch (SQLException exception)
                {
                     return (-1);     // Return -1 if some kind of problem encountered

                }

            return (code);   // Return back with the number of records affected
                             // => 1 in this case.


        } // End upDateBook()

我希望代码能够允许我更新数据库上的现有记录

0 个答案:

没有答案