Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ms-access/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 更新我的表时出错_Java_Ms Access_Sql Update - Fatal编程技术网

Java 更新我的表时出错

Java 更新我的表时出错,java,ms-access,sql-update,Java,Ms Access,Sql Update,更新takenOutTbl中的记录时出错(只有少数记录)。任何帮助都将不胜感激。这是更新代码: fine = overdueDays * 10; //the fine is calculated by multiplying the number of overdue days by the 10 simpleUpdate("update takenOutTbl set Random Calculations = Random Calculations " + fine)

更新takenOutTbl中的记录时出错(只有少数记录)。任何帮助都将不胜感激。这是更新代码:

fine = overdueDays * 10; //the fine is calculated by multiplying the number of overdue days by the 10
            simpleUpdate("update takenOutTbl set Random Calculations = Random Calculations " + fine);
它与此方法相连接:

public static void simpleUpdate(String update) throws SQLException {
    try {
        Connection connection = dc.DatabaseConnection(); //a connection to the database is established
        PreparedStatement statement = connection.prepareStatement(update); //the conenction is used to prepare the update statement which was sent to this method
        statement.executeUpdate();//the statement is executed
        statement.close(); //the prepared statement is closed
    } catch (SQLException e) {
        JOptionPane.showMessageDialog(null, "Error: the database was not updated. Please try again." );
        System.err.print(e.getMessage());
    }
}     
我收到的错误消息是:

user lacks privilege or object not found: RANDOM

请按以下方式更正您的查询:

"update takenOutTbl set [Random Calculations] = [Random Calculations] + " + fine
由于列名中有空格,您必须稍微帮助MS Access,并指出
随机计算
是一列。可以通过将列名括在括号中来实现这一点


另外,您的查询在末尾缺少一个
+
,因此我在上面的示例中也添加了这个问题。

错误消息应该给出问题的答案。它试图使用“随机”作为标识符,而不是“随机计算”。谢谢,但如果我这样做,我现在会收到此错误:“意外令牌:40”您已将
+
添加到查询的末尾,对吗?