按行将数据表拆分为多个数据表 [英] split datatable into multiple datatables by rows

查看:98
本文介绍了按行将数据表拆分为多个数据表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi。

我需要按行将数据表拆分为多个数据表。 ID列可以包含字符串

i need to split a datatable into multiple datatables by rows. ID column can contain strings

我有这个数据表

我需要3个数据表相同的列但ID列不同。喜欢这个

and i need 3 datatables with the same column but different by the ID Column. like this

谢谢

推荐答案

您可以
使用指定条件从DataTable创建DataView
,然后
调用.ToTable()将过滤后的数据转换为DataTable

Btw,取决于你想要做什么,因为DataView是数据绑定控件的有效数据源类型,您可以跳过将过滤后的表复制到分开DataTable以节省时间和内存。

Btw, depending on what you want to do, since DataView is valid type of DataSource for data binding controls, you may skip copying filtered table to separate DataTable to save time and memory.


这篇关于按行将数据表拆分为多个数据表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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