无法更新多表格(3个表格) [英] Couldn't update multitable form (3 tables)

查看:60
本文介绍了无法更新多表格(3个表格)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在更新从3个表查询的表单时遇到问题。当我在
更新外键时,它会尝试更新外键

表上的PK,但这不应该。我正在使用连接到SQL的MS Access 2003

Server 2000.


这是一个例子:


表:T1,T2和T3。

T1链接到T2,T2链接到T3。


当我更新外键时T1链接到T2,MS Access是试图更新T2的PK,而不是T1的外键,而不是T1的外键导致数据完整性错误无法更新PK在T2。 T1是表格中主要的

内容。当外键改变时,表格也应该用外国表信息更新




提前致谢,

本杰明

I''m having problem updating a form that queries from 3 tables. When I
update the foreign key it tries to update the PK on the foreign key
table which it shouldn''t. I''m using MS Access 2003 connected to SQL
Server 2000.

Here''s an example:

Tables: T1, T2, and T3.
T1 links to T2, and T2 links to T3.

When I update the foreign key on T1 that links to T2, MS Access is
trying to update the PK of T2, instead of the foreign key of T1 which
causes data integrity error "cannot update PK on T2". T1 are the main
contents of the form. When the foreign key changes the form should also
be updates with the foreign table information.

Thanks in advance,
Benjamin

推荐答案

注意,所有表格都是1:1的关系。它是标准化的。

Note, All tables are 1:1 relationship. It is normalized.


这是一个例子:


选择T1。*,T2.Field1 ,T3.Field1

来自(T1内部连接T2,T1.T2ID = T2.ID)T2内部连接T3.T3ID =

T3.ID


我不明白为什么它会更新T2.ID,当我更新T1.T2ID

字段时。这是MS Access中的错误吗?或者我可以指定哪个表格来b / b $ b更新某个地方?


谢谢,

本杰明

Here''s an example:

select T1.*, T2.Field1, T3.Field1
from (T1 inner join T2 on T1.T2ID = T2.ID) inner join T3 on T2.T3ID =
T3.ID

I dont'' understand why it would update the T2.ID, when I update T1.T2ID
field. Is this a bug in MS Access? or could I specify which table to
update somewhere?

Thanks,
Benjamin


你是否在

两个表之间的关系中打开了级联更新?


Jeremy

-

Jeremy Wallace
http:// metrix.fcny.org

Do you have cascade updates turned on in the relationship between the
two tables?

Jeremy
--
Jeremy Wallace
http://metrix.fcny.org


这篇关于无法更新多表格(3个表格)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆