简体   繁体   English

MS-Access链接表的并发错误

[英]Concurrency error with MS-Access Linked Tables

I am linking tables to a SQL 2008R2 DB via MS Access Linked Tables. 我通过MS Access链接表将表链接到SQL 2008R2 DB。

I am getting this warning when I want to change the data in an Access linked table where the underlying SQL table has more than one bit field in it: 我要更改Access链接表中的数据时会收到此警告,其中基础SQL表中有多个位字段:

The record has been changed by another user since you started editing it. 自您开始编辑该记录以来,该记录已被其他用户更改。 If you save the record, you will overwrite the changes the other user made 如果保存记录,则将覆盖其他用户所做的更改

I don't have any problems when there is only one bit field in the table. 当表中只有一位字段时,我没有任何问题。 It's really a strange error imho. 天哪,这真是一个奇怪的错误。 Has any one else encountered this before and found a work around for it by any chance? 之前是否有人遇到过这种情况,并找到了解决方法?

I've seen this sort of issue in working with linked tables in general with SQL. 我通常在使用SQL处理链接表时已经看到这种问题。 I'm not sure why you're seeing the issue specifically with bit fields. 我不确定为什么您会看到特定于位字段的问题。 Try adding a 'ts' column with the datatype of timestamp (rowversion) to the table and relink it in Access. 尝试在表中添加带有时间戳(行版本)数据类型的“ ts”列,然后在Access中将其重新链接。

I know this is an old question, but maybe my answer will benefit others since I struggled with same and other similar issues. 我知道这是一个古老的问题,但是由于我在相同和其他类似的问题上苦苦挣扎,所以我的答案也许会对其他人有益。

I had similar error and was mostly able to get around it. 我有类似的错误,并且大多数情况下都可以解决。 One thing that may help is to use SQL Profiler on the database and watch the SQL commands made by Access while you are trying to add a new row. 可能有帮助的一件事是,在数据库中使用SQL事件探查器,并在尝试添加新行时观察Access发出的SQL命令。

Few things to check.. 1) Verify that you have an ID column in the table set as the Primary key and AutoNumber 2) If this involves a master/child relationship between another table, in the Access Database Tools "Relationships", specify the relationship and the join type between these types. 无需检查。1)验证表中是否将ID列设置为主键和自动编号2)如果这涉及另一个表之间的主/子关系,请在Access数据库工具“关系”中指定关系和这些类型之间的联接类型。 3) If a join between tables, then play around with the primary column and foreign column being exposed in the query. 3)如果表之间是联接,则在查询中暴露主列和外部列。

Using the SQL Profiler, I would see where it would try to find the row to update based on other columns besides the primary key. 使用SQL事件探查器,我将看到它将根据主键之外的其他列尝试在何处查找要更新的行。 eg 例如

update table set ... where id = 5 and data1 = somevalue and data2 == othervalue 更新表集...其中id = 5并且data1 = somevalue和data2 == othervalue

When doing this, I would sometimes get the same error since I may have edited other values in the new row and therefore the complex where clause would fail. 这样做时,有时会出现相同的错误,因为我可能已经在新行中编辑了其他值,因此复杂的where子句将失败。 What you want is to have the update rely totally on the primary key. 您想要的是使更新完全依赖主键。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM