Access 2007 约束子句中的奇怪错误

发布于 2025-01-03 18:01:21 字数 585 浏览 2 评论 0原文

Relationship must be on the same number of fields with the same data types. (Error 3368)
The CONSTRAINT clause you are using to create a relationship includes a different number of fields for each table or includes fields with different data types. Check the number of fields in the CONSTRAINT clause, check the data types of fields to make sure they match, and try again.

我以前从未遇到过这个问题。我有两个表,它们之间具有单一的一对多关系。我从一个表到另一个表指定了自己的主键。它们都是相同的数据类型(数字)。如果一个表比另一个表具有更多字段,为什么会很重要?这似乎只有当我分配自己的主键时才会发生。 “许多”表已建立索引(没有重复项)。我已经尝试过“一”表所需的和不需要的。什么给?无论价值如何,没有参照完整性的关系都是允许的。

Relationship must be on the same number of fields with the same data types. (Error 3368)
The CONSTRAINT clause you are using to create a relationship includes a different number of fields for each table or includes fields with different data types. Check the number of fields in the CONSTRAINT clause, check the data types of fields to make sure they match, and try again.

I've never ran into this problem before. I have two tables which have a single one-to-many relationship between them. I designated my own primary key from one table to the other. They are both of the same data type (number). Why should it matter if one table has more fields than another? This only seems to happen when I assign my own primary key. The 'many' table is indexed (no duplicates). And I've tried required and and not required for the 'one' table. What gives? I relationship with no referential integrity is allowed, for whatever that's worth.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

懒的傷心 2025-01-10 18:01:21

小数和整数不被视为等效的数字类型。您必须将 CountryPK 更改为长整型,或将 CountryFK 更改为小数。您也可以对两者都使用 Double。

Decimals and Integers are not considered equivalent numeric types. You must change either CountryPK to Long Integer or the CountryFK to Decimal. You can also use Double on both.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文