简体   繁体   English

将多个DataView合并为一个?

[英]combine multiple DataViews into a single one?

I have 4 different select statements which i sequently assign to an sqlDataSource like this: 我有4个不同的select语句,这些语句随后分配给sqlDataSource,如下所示:

sqlNoutatiProduse.SelectCommand = select;

and i keep the results in different DataViews like 我将结果保存在不同的DataViews中

MySession.Current.dataViewNoutatiProduse1 = (System.Data.DataView)sqlNoutatiProduse.Select(DataSourceSelectArguments.Empty);

and so on. 等等。

Is it possible to combine into a single DataView the results of these queries? 是否可以将这些查询的结果合并到一个DataView中?

Without more details, this is the best generic answer I can give... 没有更多细节,这是我能给出的最好的通用答案。

It's possible to create a DataTable manually, add the columns you need, and then loop through the DataViews to add records to your new table. 可以手动创建一个DataTable,添加所需的列,然后遍历DataView将记录添加到新表中。 I've used this technique where I can't do the work at the DB level. 我在数据库级无法使用的情况下使用了此技术。 However, this would be horribly inefficient. 但是,这将是非常低效的。

You'd be better off seeing if you can get the data you want it directly from the DB. 最好查看是否可以直接从数据库获取所需的数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM