c#用代码定义带数据的datatable-创新互联

让客户满意是我们工作的目标,不断超越客户的期望值来自于我们对这个行业的热爱。我们立志把好的技术通过有效、简单的方式提供给客户,将通过不懈努力成为客户在信息化领域值得信任、有价值的长期合作伙伴,公司提供的服务项目有:主机域名、虚拟空间、营销软件、网站建设、大洼网站维护、网站推广。> 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); //再加一行

           DataRow row22 = customerTable.NewRow();
           row22["clsCustomerID"] = "01.2311";
           row22["clsCustomerNM"] = "HGC_W1";

           customerTable.Rows.Add(row22); //第三行

           comboBox1.DataSource = customerTable;
           comboBox1.DisplayMember = "clsCustomerNM";
           comboBox1.ValueMember = "clsCustomerID"; //将设置好的datatable 赋值给 comboBox


本文题目:c#用代码定义带数据的datatable-创新互联
文章路径:http://scyanting.com/article/csipdg.html