c#如何把一行数据插入到datatable里面去?

DataTable dt = new DataTable(); 
dt.Columns.Add("ID"); 
dt.Columns.Add("Name"); 
DataRow dr = dt.NewRow(); 
object[] objs = { 1, "Name" }; 
dr.ItemArray = objs; 
dt.Rows.Add(dr); 
this.dataGridView1.DataSource = dt;
posted @ 2012-05-28 21:17  小锋神  阅读(10640)  评论(0编辑  收藏  举报