对两个数据集中的数据进行分组
我的数据集有问题:
我有来自两个不同服务器的两个数据集,但它们具有相同的列。
所以就像这样:
第一个数据集:
asset description make jobtype jan feb ... dec
0001 mine ik Acc 0 0 10
0002 yours ic Over 0 0 10
第二个数据集:
asset description make jobtype jan feb ... dec
0001 mine ik Acc 10 0 10
0002 yours ic Gen 0 0 0
但我想将 2 个数据集合并为一个这样的数据集:
asset description make jobtype lhjan imjan lhfeb lhfeb ... lhdec imdec
0001 mine ik Acc 0 10 0 0 10 10
0002 yours ic Over 0 0 0 0 10 0
因此一个数据集的所有数据都与具有相同资产和相同作业类型的第二个数据集合并。
我尝试 linq 但我无法达到我想要的效果。 我正在研究 vb.net 框架 3.5。
你能帮我吗?
朱利安
i've got a problem with dataset:
I've got two dataset from two different server but they have the same columns.
so it's like that:
First DataSet :
asset description make jobtype jan feb ... dec
0001 mine ik Acc 0 0 10
0002 yours ic Over 0 0 10
Second dataset :
asset description make jobtype jan feb ... dec
0001 mine ik Acc 10 0 10
0002 yours ic Gen 0 0 0
But i would like to merge the 2 dataset into one like that:
asset description make jobtype lhjan imjan lhfeb lhfeb ... lhdec imdec
0001 mine ik Acc 0 10 0 0 10 10
0002 yours ic Over 0 0 0 0 10 0
so all the data from one is combine with the second with the same asset and the same jobtype.
I try linq but i can't arrive to make it like i want.
I'm working on vb.net framework 3.5.
could you help me?
Julien
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您实际上只是想连接两者,则可以在 2 个不同的 Adaptor.fill() 中使用相同的数据集。
如果在第二次 FILL 之前不使用 NEW DATASET,则这两个数据集将被合并。
If you literally just want to join the two, you can use the same DATASET in 2 different Adaptor.fill().
If you do not use a NEW DATASET before the second FILL, the 2 will get merged.
我只是想确保数据源 1 和 2 实际上是数据表。这就是我的回答将如何描述这一点。我也会用 C# 来描述它,尽管语法差别不大。您需要更改混合字段的选择。您还需要根据需要调整数据类型,
这是近似 vb 语法:
i just want to make sure that data sources 1 and 2 are actually data tables. this is how my answer will describe this. ill also be describing it in C#, though the syntax doesn't differ much. you need to alternate your selections for the intermingled fields. you'll also need to adjust your datatypes as necessary
here is the approximate vb syntax: