1

所以我正在尝试做一个插入语句。paramDataArray持有的值是paramDataArray[]="kkkkkkk"。一切正常,直到我走到executeupdate底部然后它抛出一个异常。这是无效的对象名称' innovationtable'。

要创建我的表,我这样做

 try{ 

        mydataobject.executeQuery("create table innovationtable(ReqName text, " +
                                  "Locbook text," +
                                  "Datewanted text, " +
                                  "Duration text, " +
                                  "Client text, " +
                                  "Speaker text, " +
                                  "Demo textt); ");
      }
      catch (SQLException ex)
      {

      }

以下是我插入表格的操作;

      String insertQuery = "insert into innovationtable(ReqName, Locbook, Datewanted, Duration, Client,Speaker,Demo)" + 
              " values (?,?,?,?,?,?,?)";

             // setting up prepared statement for executing the insert Query
              PreparedStatement preparedStatement = mydataobject.getConnection().prepareStatement(insertQuery);

              preparedStatement.setString(1, paramDataArray[0]);
              preparedStatement.setString(2, paramDataArray[1]);
              preparedStatement.setString(3, paramDataArray[2]);
              preparedStatement.setString(4, paramDataArray[3]);
              preparedStatement.setString(5, paramDataArray[4]);
              preparedStatement.setString(6, paramDataArray[5]);
              preparedStatement.setString(7, paramDataArray[6]);

              preparedStatement.executeUpdate();

抛出异常:

无效的对象名称“创新表”。在 com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Unknown Source) 在 com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(Unknown Source) 在 com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(Unknown Source) 在 com .microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(Unknown Source) at com.microsoft.sqlserver.jdbc.TDSCommand.execute(Unknown Source) at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(Unknown Source) at com .microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(Unknown Source) at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(Unknown Source) at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement。

4

0 回答 0