RowFilters与相关表 [英] RowFilters with related tables

查看:52
本文介绍了RowFilters与相关表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两张桌子,让我们只说主人和细节。 Master是

父表,详细说明子表。


我想要的是在子项上创建一个行过滤器。但是我也希望在主表上创建一个行过滤器,这样只有那些

的子记录符合子表过滤器中的条件的子记录才会<包含



即只有一个或多个符合条件的孩子的主记录。


这可以做到吗有行过滤器?我的意思是,我可以通过孩子

表获取所有唯一外键的列表,并在

上执行IN操作。我宁愿不要在几个方面这样做,包括,我们可能会讨论成千上万的记录,然后你可能会得到一个真正的

巨大的过滤字符串这是不可取的。我想我正在寻找

是更自动的东西,如果修改了子数据

set,则不需要修改。我怀疑没有办法做SQL风格的关系

过滤器,但认为值得问一下以防万一。


Pete

解决方案

Pete,


阅读您的文本如果选择可以帮助您,我有疑问。

http://msdn.microsoft.com/library/de...electtopic.asp


否则我会选择getchildrows看看是否为零。
http://msdn.microsoft.com/library/de...drowstopic.asp


我希望这会有所帮助


Cor


" Cor Ligthert [MVP]" <无************ @ planet.nl>在消息中写道

新闻:O1 ************* @ TK2MSFTNGP10.phx.gbl ...

Pete,

阅读你的文字如果选择可以帮助你我有疑问。

http://msdn.microsoft.com/library/de...electtopic.asp

否则我会选择getchildrows,看看是否为零。
http://msdn.microsoft.com/library/de...drowstopic.asp

我希望这会有所帮助

Cor




谢谢,但那不会这样做。我想我忽略了提到

这是必须以RowFilter完成的,因为它是一个绑定到网格控件的DataViewManager。我希望网格只显示

的父行,有孩子的父母和满足行过滤器的孩子

条件。


我知道,这可能是在默默无闻之地。我的意思是,只是

搞清楚如何将网格绑定到DataViewManager并应用过滤器需要花费一些时间来进行挖掘。 MS并没有真正用它们来记录这个

的东西。


Pete


< blockquote>如果您的表/数据库已正确规范化(第4范式),那么

遍历关联表。您将拥有的MasterDetail

用于解决许多问题桌子之间的关系很多。


干杯


Denis

Pete Davis < pdavis68 @ [NOSPAM] hotmail.com>在消息中写道

新闻:o7 ******************** @ giganews.com ...

我有两张桌子,让我们只说主人和细节。 Master是
父表,详细说明子表。

我想要的是在子节点上创建一个行过滤器。但我还想在主表上创建一个行过滤器,以便只包含符合子表过滤器条件的子记录。
。 >
也就是说,只有一个或多个符合条件的孩子的主记录。

这可以通过行过滤器完成吗?我的意思是,我可以通过子
表来获取所有唯一外键的列表,并对它们执行IN操作
。我宁愿不要在几个方面这样做,包括,我们可能会谈论成千上万的记录然后你最终会得到一个非常糟糕的过滤字符串,这是不可取的。我想我正在寻找
for是更自动的东西,如果修改了子
数据集,则不需要修改。我怀疑没有办法做SQL风格的关系过滤器,但认为值得问一下以防万一。

Pete


I have two tables, let''s just say Master and Details. The Master is the
parent table, Details the child table.

What I want is to create a row filter on the children. But I also want to
create a row filter on the master table such that only master records that
have children that meet the criteria in the children table filter, will be
included.

That is, only master records with one or more qualifying children.

Can this be done with row filters? I mean, I could go through the child
table to get a list of all the unique foreign keys and do an IN operation on
them. I''d rather not go this way on several grounds including, we could be
talking about thousands of records and then you could end up with a really
huge filter string which would be undesirable. I guess what I''m looking for
is something more automatic that won''t have to be modified if the child data
set is modified. I suspect there''s not a way to do SQL style relational
filters, but thought it was worth asking just in case.

Pete

解决方案

Pete,

Reading your text I am in doubt if the select can help you.

http://msdn.microsoft.com/library/de...electtopic.asp

Otherwise I would go for the getchildrows and see if that is zero.
http://msdn.microsoft.com/library/de...drowstopic.asp

I hope this helps something

Cor


"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:O1*************@TK2MSFTNGP10.phx.gbl...

Pete,

Reading your text I am in doubt if the select can help you.

http://msdn.microsoft.com/library/de...electtopic.asp

Otherwise I would go for the getchildrows and see if that is zero.
http://msdn.microsoft.com/library/de...drowstopic.asp

I hope this helps something

Cor



Thanks, but that''s not going to do it. I guess what I neglected to mention
is this has to be done as a RowFilter since it''s a DataViewManager which is
bound to a grid control. I want the grid to only show the parent rows for
parents that have children and the children which meet the row filter
criteria.

I know, this is probably some where in the land of obscurity. I mean, just
figuring out how to bind a grid to a DataViewManager and apply filters took
a bit of digging. MS didn''t really go out of their way to document this
stuff.

Pete


If your tables/database is properly normalized (4th normal form) then
iterate through the associate table.. MasterDetail which you would have
built to resolve the many to many relationships between the tables.

Cheers

Denis
"Pete Davis" <pdavis68@[nospam]hotmail.com> wrote in message
news:o7********************@giganews.com...

I have two tables, let''s just say Master and Details. The Master is the
parent table, Details the child table.

What I want is to create a row filter on the children. But I also want to
create a row filter on the master table such that only master records that
have children that meet the criteria in the children table filter, will be
included.

That is, only master records with one or more qualifying children.

Can this be done with row filters? I mean, I could go through the child
table to get a list of all the unique foreign keys and do an IN operation on them. I''d rather not go this way on several grounds including, we could be
talking about thousands of records and then you could end up with a really
huge filter string which would be undesirable. I guess what I''m looking for is something more automatic that won''t have to be modified if the child data set is modified. I suspect there''s not a way to do SQL style relational
filters, but thought it was worth asking just in case.

Pete



这篇关于RowFilters与相关表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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