DataTable 添加新行

xiaoxiao2026-06-14  5

DataTable添加行 //新建表 DataTable dt=new DataTable(); //定义表结构 dt.Columns.Add("Id",typeof(System.Int32)); dt.Columns.Add("Code",typeof(System.String)); dt.Columns.Add("Name",typeof(System.String)); //添加新行 for(int i=0;i<=3;i++) { DataRow dr=dt.NewRow(); dr[0]=i; dr[1]="s"+i; dr[2]="sic"+i; dt.Rows.Add(dr); }

 

相关资源:datagridview绑定datatable数据,添加合计行,后可排序
转载请注明原文地址: https://www.6miu.com/read-5050158.html

最新回复(0)