如何检索新的数据视图 [英] How to retrieve a new dataview
问题描述
能否请您帮我找到解决方案.我不想遍历dataview.rowfilter
返回的结果数据中的每个数据行.我有一个数据表,并用它来过滤所需的行:
datatable.defaultview.rowfilter =选择性条件"
我想将结果检索到新的dataview(称为newview
)中,然后可以使用其他条件(例如newview.rowfilter ="..."
)过滤其他行集合.
希望你理解我的问题.我不想使用组合条件(传递给原始defaultview的rowfilter).
任何帮助将不胜感激.
非常感谢!
使用 DataView .ToTable [^ ] :
DataTable dt = (some query expression); dt.DefaultView.RowFilter = " ... "; DataTable dt2 = dt.DefaultView.ToTable();
请注意,这将复制数据.但是我认为,对于您的问题的任何解决方案都必须发生这种情况,因为您希望保持初始表完整无缺,而不要使用组合的过滤器表达式(这将是您在不复制数据的情况下创建双重过滤视图的方式). /blockquote>
Could you please help me in finding a solution. I don''t want to loop through each datarow in the result data returned from
dataview.rowfilter
. I have a datatable and I use this to filter for the desired rows:
datatable.defaultview.rowfilter = "selective condition"
I want to retrieve the result into a new dataview( call itnewview
) and then I can filter for another collection of rows with another condition like this newview.rowfilter = "..."
Hope you understand my problem. I don''t want to use combined conditions (to pass to the rowfilter of the original defaultview).
Any help is greatly appreciated.
Thank you very much!解决方案Use DataView.ToTable[^]:
DataTable dt = (some query expression); dt.DefaultView.RowFilter = " ... "; DataTable dt2 = dt.DefaultView.ToTable();
Note that this will copy the data. But I think that that has to happen for any solution to your problem, because you want to leave the initial table intact and not use a combined filter expression (which would be how you would create a double-filtered view without copying data).
这篇关于如何检索新的数据视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!