This is my code:
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];
from that table
I need to take all the rows that its Campaign
column exists in this list List<string> compaines = new List<string>();
What have I tried
I tried this:
table = (from row in table.AsEnumerable()
where compaines.Contains(row.Field<string>("Campaign"))
select row);
but I got this exception on the select
:
Cannot implicitly convert type 'System.Data.EnumerableRowCollection<System.Data.DataRow>' to 'System.Data.DataTable'