Access DB: Operation must use an updateable query

放肆的年华 提交于 2019-12-11 03:14:22

问题


I am running an ISS server, i have an access file located in C:\WCF\Access\ I am using this query to insert something:

@"INSERT INTO Arbejdsindsats (MedarYdelID, StartTid, SlutTid) VALUES ('" + medarYdelID + "', '" + startTid + "', '" + slutTid + "')";

The full code is:

public String GemArbejdsIndsats(String medarYdelID, String startTid, String slutTid)
        {
            try{
            con.Open();
            String command = @"INSERT INTO Arbejdsindsats (MedarYdelID, StartTid, SlutTid) VALUES ('" + medarYdelID + "', '" + startTid + "', '" + slutTid + "')";
            cmd.CommandText = command;
            cmd.ExecuteNonQuery();
            con.Close();


                return "success: medarydelid: " + medarYdelID + " startTid: " + startTid + " slutTid: " + slutTid;
            } catch(Exception e)
                {
                    String k = e.Message;
                    return k;
                }
        }

The problem is this error:

Operation must use an updateable query

When i test locally on my own machine, it works fine. Just not in the IIS.

The weird thing is that there's a laccdb file. it wont go away. Maybe the database is locked and thats why i cant update it?

The permission should not be a problem:

img http://img.ctrlv.in/50c0dbf8670d8.jpg


回答1:


The user account must be able to write to the files and to the folder in which they are located; it should be able to create and delete files in the folder. The presence of the laccdb file does not necessarily mean that access has locked the database. Its presence could be the result of any of several circumstances, one of which could be that the user account doesn't have permission to delete files from the folder.




回答2:


solution of this issue is pretty simple. just run that application as administrator. i tried it 3 times and it worked perfectly




回答3:


Also, Make sure the file is not Read Only.



来源:https://stackoverflow.com/questions/13749572/access-db-operation-must-use-an-updateable-query

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!