【发布时间】:2014-08-19 09:37:28
【问题描述】:
这是我的代码:
SqlCommand vmpCmd = new SqlCommand("sp", connectionstring);
SqlDataAdapter DAvmp = new SqlDataAdapter(vmpCmd);
DataSet DSvmp = new DataSet();
DSvmp.Clear();
DAvmp.Fill(DSvmp);
DataTable table;
table = DSvmp.Tables[0];
从 table 我需要获取其 Campaign 列存在于此列表中的所有 行 List<string> compaines = new List<string>();
我尝试了什么
我试过了:
table = (from row in table.AsEnumerable()
where compaines.Contains(row.Field<string>("Campaign"))
select row);
但我在select 上遇到了这个异常:
Cannot implicitly convert type 'System.Data.EnumerableRowCollection<System.Data.DataRow>' to 'System.Data.DataTable'
【问题讨论】: