我的github

LINQ 查询适用于实现的数据源 IEnumerable<T>接口或System.Query.IQueryable接口。

DataTable类默认是没有实现以上接口的。

https://www.cnblogs.com/wangdongying/p/13410741.html

 

>>

1、新建表   private DataTable vsDt =new DataTable();
2、清空表中内容(表中的列还在)  vsDt.Clear();  
3、清空表中的列   vsDt.Columns.Clear();
4、表中添加列
vsDt.Columns.Add("BH", typeof(string));
vsDt.Columns.Add("RQ", typeof(string));
5、表中添加空行
 DataRow vsDr = vsDt.NewRow();
假如在添加空行之前,已经往表中添加了N列,那么此时新加的空行,也带有这些列。
6、表中添加行   vsDt.Rows.Add(vsDr);  
posted on 2022-08-02 11:55  XiaoNiuFeiTian  阅读(655)  评论(0)    收藏  举报