ADO.NET數據綁定 DataTabele
阿新 • • 發佈:2017-09-02
ecs items arr 指定 eof clas seed code typeof
DataTable把數據映射到本地緩存表中
DataTable datable = new DataTable (); //使用指定列名稱和數據類型初始化 DataColumn colum = new DataColumn(); //取列的數據類型 column.ColumnName = "ID"; colum.DataType=typeof(Int32); colum.AutoIncreament = true;//值自增長 colum.AutoIncreamentSeed = 1;//初始值為1 datable.Columns.Add(column); datable.Columns.Add(new DataColumn("進程",typeof(steing))); string[]proecss = System.Diagnostics.Process.GetProcesses().Select(p= >p.ProcessName).ToArray(); foreach (string p in process) { DataRow row = datable.NewRow(); row[1] = p; datable.Rows.Add(row); } foreach(DataRow dr in datable.Rows) { listBox1.Items.Add(dr[1].ToString()); }
ADO.NET數據綁定 DataTabele