自定义datatable的列类型,并填充数据-创新互联
comb
当前名称:自定义datatable的列类型,并填充数据-创新互联
URL地址:http://scyanting.com/article/ccihjj.html

DataTable customerTable = new DataTable();
customerTable.Columns.Add("clsCustomerID", typeof(string)); //定义列类型
customerTable.Columns.Add("clsCustomerNM", typeof(string));
DataRow row= customerTable.NewRow(); //加一行
row["clsCustomerID"] = "01.2136";
row["clsCustomerNM"] = "MAXIS1";
customerTable.Rows.Add(row);
DataRow row1= customerTable.NewRow(); //加另一行
row1["clsCustomerID"] = "01.2255";
row1["clsCustomerNM"] = "VSC2_PRE_W1";
customerTable.Rows.Add(row1);
comboBox1.DataSource= customerTable; //设置datasource 和 显示和实际数据列
comboBox1.DisplayMember= "clsCustomerNM";
comboBox1.ValueMember= "clsCustomerID";
当前名称:自定义datatable的列类型,并填充数据-创新互联
URL地址:http://scyanting.com/article/ccihjj.html