Datatable 增加一列并为该列赋上相应的值

            DataTable dt = new DataTable();
            dt.Columns.Add("Name1", typeof(int));
            dt.Columns.Add("Name2", typeof(object));
            dt.Columns.Add("Name3", typeof(object));
            for (int i = 0; i < 200; i++)
            {
                dt.Rows.Add( i, "款号" + Convert.ToString(i), "色号" + Convert.ToString(i));

            }
            gridControl1.DataSource = dt;

 


 

___________________________________________________________________________________________________________

===========================================================================================================

           

 DataTable dt = new DataTable();
            dt.Columns.Add("Name1", typeof(int));
            dt.Columns.Add("Name2", typeof(object));
            dt.Columns.Add("Name3", typeof(object));
            for (int i = 0; i < 200; i++)
            {
                dt.Rows.Add( i, "款号" + Convert.ToString(i), "色号" + Convert.ToString(i));

            }
            gridControl1.DataSource = dt;


 

 

posted @ 2014-11-04 15:44  博客园董事长  阅读(2134)  评论(0)    收藏  举报