INF:JET 4支持级联到空的关系 [英] INF: Cascade-to-Null relations are supported in JET 4
问题描述
在Access 2000及更高版本中,您可以创建表之间的关系,其中
相关记录可以自动设置为Null而不是在删除主记录时删除
。
我没有看到有人使用或讨论这个功能,所以有一篇新的
文章解释了这个概念:
级联与无关系
at:
http ://allenbrowne.com/ser-64.html
-
Allen Browne - 微软MVP。西澳大利亚州珀斯。
访问用户提示 - http:// allenbrowne.com/tips.html
回复群组,而不是mvps dot org的allenbrowne。
< blockquote> Allen Browne写道:
在Access 2000及更高版本中,您可以创建表之间的关系,其中
相关记录可以自动设置
主要记录被删除时为空而不是删除。
我没有看到有人使用或讨论此功能,所以有一个新的
文章解释了这里的概念:
级联到无关系
at:
http://allenbrowne.com/ser-64.html
很好。谢谢你的好解释。有什么缺点吗?
-
''---------------
''John Mishefske
''---------------
没有缺点,约翰。
我已经在现实世界的应用程序中使用这个已超过12个月了。
唯一的问题是可能性数据库没有被其他人正确重建
所以文章解决了维护问题。
-
Allen Browne - 微软MVP。西澳大利亚州珀斯。
访问用户提示 - http:// allenbrowne.com/tips.html
回复群组,而不是mvps dot org的allenbrowne。
" John Mishefske" < jm ********** @ SPAMyahoo.com在留言中写道
新闻:ty ************* @ tornado.rdc-kc。 rr.com ...
Allen Browne写道:
>在Access 2000及更高版本中,您可以创建表之间的关系,其中
相关记录可以自动设置为Null而不是删除主记录时删除。
我没有看到任何人使用或讨论这个功能,所以有一篇新文章在这里解释这个概念:
级联到空的关系
在:
http://allenbrowne.com/ser-64.html
Nice 。谢谢你的好解释。有什么缺点吗?
-
''---------------
''John Mishefske
''---------------
< blockquote>在Access 2000及更高版本中,您可以在表格之间创建关系
其中相关记录可以自动设置为Null而不是
删除主记录时删除。
我还没有看到有人使用或讨论过这个功能,所以有一篇新的文章来解释这个概念:
级联到无关系
at:
http://allenbrowne.com/ser-64.html
它也记录在Jet SQL参考中,例如参见
关于约束条款的帮助文件:
"语法
单场约束:
>
CONSTRAINT名称{PRIMARY KE Y |独一无二| NOT NULL |
REFERENCES foreigntable [(foreignfield1,foreignfield2)]
[ON UPDATE CASCADE | SET NULL]
[ON DELETE CASCADE | SET NULL]}"
所以,在你的样本中,你可以像任何其他Jet DDL一样通过
ADO来启动它
< br $>
Sub MakeRelJetADO()
Dim strSql As String
strSql =" ALTER TABLE tblProduct ADD CONSTRAINT FK_ProdCat" &安培; _
" FOREIGN KEY(CategoryID)REFERENCES" &安培; _
" tblCategory(CategoryID)ON DELETE SET NULL"
CurrentProject.Connection.Execute strSql ,, _
adExecuteNoRecords + adCmdText
结束子
-
Roy-Vidar
In Access 2000 and later, you can create a relation between tables where
related records can be automatically set to Null rather than deleted when
the primary record is deleted.
I have not seen anyone using or discussing this feature, so there is a new
article explaining the concept here:
Cascade to Null Relations
at:
http://allenbrowne.com/ser-64.html
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
Allen Browne wrote:In Access 2000 and later, you can create a relation between tables where
related records can be automatically set to Null rather than deleted when
the primary record is deleted.
I have not seen anyone using or discussing this feature, so there is a new
article explaining the concept here:
Cascade to Null Relations
at:
http://allenbrowne.com/ser-64.html
Nice. Thanks for the great explanation. Any downsides?
--
''---------------
''John Mishefske
''---------------
No downsides, John.
I''ve been using this in real-world apps for more than 12 months now.
The only issue is the posssibility that the database is not rebuilt properly
by someone else, so the article addresses that maintenance question.
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"John Mishefske" <jm**********@SPAMyahoo.comwrote in message
news:ty*************@tornado.rdc-kc.rr.com...Allen Browne wrote:>In Access 2000 and later, you can create a relation between tables where
related records can be automatically set to Null rather than deleted when
the primary record is deleted.
I have not seen anyone using or discussing this feature, so there is a
new article explaining the concept here:
Cascade to Null Relations
at:
http://allenbrowne.com/ser-64.html
Nice. Thanks for the great explanation. Any downsides?
--
''---------------
''John Mishefske
''---------------
In Access 2000 and later, you can create a relation between tableswhere related records can be automatically set to Null rather than
deleted when the primary record is deleted.
I have not seen anyone using or discussing this feature, so there is
a new article explaining the concept here:
Cascade to Null Relations
at:
http://allenbrowne.com/ser-64.htmlIt''s also documented in the Jet SQL reference, see for instance the
help file on the constraint clause:
"Syntax
Single-field constraint:
CONSTRAINT name {PRIMARY KEY | UNIQUE | NOT NULL |
REFERENCES foreigntable [(foreignfield1, foreignfield2)]
[ON UPDATE CASCADE | SET NULL]
[ON DELETE CASCADE | SET NULL]}"
So, in your sample, you could fire it like any other Jet DDL through
ADO, too
Sub MakeRelJetADO()
Dim strSql As String
strSql = "ALTER TABLE tblProduct ADD CONSTRAINT FK_ProdCat " & _
"FOREIGN KEY (CategoryID) REFERENCES " & _
"tblCategory (CategoryID) ON DELETE SET NULL"
CurrentProject.Connection.Execute strSql, , _
adExecuteNoRecords + adCmdText
End Sub
--
Roy-Vidar
这篇关于INF:JET 4支持级联到空的关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!