ArrayList 转换为DataTable

                    int[] arr = new int[] { 13, 20 };
                    ArrayList list = new ArrayList(arr);

                    var dt = new DataTable();
                    DataColumn dc = new DataColumn("no");
                    dt.Columns.Add(dc);
                    DataRow row;
                    for (int i = 0; i < list.Count; i++)
                    {

                        row = dt.NewRow();
                        row["no"] = list[i];
                        dt.Rows.Add(row);
                    }

 

posted on 2016-07-22 15:41  Frank-  阅读(2048)  评论(0编辑  收藏  举报

导航