日期:2014-05-17 浏览次数:20796 次
int i = 1; foreach (DataRow dr in dt.Rows) { gkxx = new Proj_cfxfgkxx(); gkxx.lxdh = dr["联系电话"].ToString(); }
List<string> temp_list = dt.AsEnumerable().Select(a => a.Field<string>("lxdh")).ToList();
------解决方案--------------------
gkxx.lxdh 是个List<string>吧?
foreach (DataRow dr in dt.Rows) { gkxx = new Proj_cfxfgkxx(); //填加到List里 gkxx.lxdh.Add(dr["联系电话"].ToString()); } //转成string加"," string s = string.Join("','",gkxx.lxdh.ToArray()); //写你的SQL select * from ---- where lxdh in ('" + s + "')" 判断就行了。