WCF服务可以更新DBF文件 - 仅读取&quot"错误
我有一个 wcf 4 服务,正在尝试将记录添加到同一服务器上的 Visual Fox Pro dbf 文件中。当它尝试执行插入时,我收到“无法更新游标 USER,因为它是只读的”。
我认为这是一个权限问题。我需要做什么才能授予 wcf 服务更新我的 dbf 文件的权限?
这适用于我的开发机器。
这是一些代码:
OleDbConnection oConn = new OleDbConnection("provider=vfpoledb;Data Source="\\data\\tt.dbc");
oConn.Open();
OleDbCommand oCommand = new OleDbCommand();
oCommand.Connection = oConn;
oCommand.CommandText = "SET NULL OFF\r\nSET DELETED ON";
oCommand.ExecuteNonQuery();
OleDbCommand mycmd = new OleDbCommand("insert into user (lastname,firstname) values ('Doe','John')", oConn);
mycmd.CommandType = CommandType.Text;
lnRet = mycmd.ExecuteNonQuery();
I have a wcf 4 service that is trying to add a record to a visual fox pro dbf file on the same server. When it tries to do the insert I get "Cannot update the cursor USER, since it is read-only."
I assume that this is a permissions problem. What do I have to do to give permission to the wcf service to update my dbf file?
This works on my develpment machine.
Here is some of the code:
OleDbConnection oConn = new OleDbConnection("provider=vfpoledb;Data Source="\\data\\tt.dbc");
oConn.Open();
OleDbCommand oCommand = new OleDbCommand();
oCommand.Connection = oConn;
oCommand.CommandText = "SET NULL OFF\r\nSET DELETED ON";
oCommand.ExecuteNonQuery();
OleDbCommand mycmd = new OleDbCommand("insert into user (lastname,firstname) values ('Doe','John')", oConn);
mycmd.CommandType = CommandType.Text;
lnRet = mycmd.ExecuteNonQuery();
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这不是权限问题 - 这会生成拒绝访问错误。
要检查两件事:
文件是否标记为只读?
该文件是否正在被任何其他进程使用?
我认为#2更有可能 - 我没有做过FoxPro,但我已经用Clipper做了很多dBase,并且至少在dBase下,文件必须以独占方式打开(即不共享)才能进行插入/更新/删除。
It's not a permissions problem - that would generate an access denied error.
Two things to check:
Is the file marked as read-only?
Is the file being used by any other process?
I think #2 is more likely - I haven't done FoxPro, but I've done a lot of dBase with Clipper, and at least under dBase the file has to be opened exclusively (i.e., not shared) to do inserts/updates/deletions.
您需要验证用于运行 WCF 服务的凭据是否具有对数据 UNC 路径的读/写访问权限。
You need to verify that the credentials that are used to run the WCF service have Read/Write access to the data UNC path.