![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
1 private void cbbType_SelectedIndexChanged(object sender, EventArgs e) 2 { 3 //清空DN列 4 cbbDn.Items.Clear(); 5 //字段清除 6 FieldListSaddle.Clear(); 7 //加入字段 8 FieldListSaddle.Add("Baojiao,Drawing,Table,Ribs,Type1,HasPad"); 9 //定义查询条件 10 string where = string.Format("DnX < {0} and DnD >= {0} and Type2 = '{1}'", DI, cbbType.Text); 11 //按照条件查询表 12 tbBiao = GetAccessData(TypeName, FieldListSaddle, where); 13 //如果表中有两列数据则需要循环查找并添加 14 for (int i = 0; i < tbBiao.Rows.Count; i++) 15 { 16 //表名等于第一行数据的表 17 string TableName = (tbBiao.Rows[i]["Table"]).ToString(); 18 //查询出DN表放入内存 19 tbDn = GetAccessData(TableName); 20 //查询出符合DN的那一列 21 DnList = tbDn.AsEnumerable().Select(p => p.Field<double>("DN").ToString()).Distinct().ToList(); 22 //加入控件中 23 cbbDn.Items.AddRange(DnList.ToArray()); 24 } 25 }