Reputation: 135
the query below is a query that will get data from a column to see if the data contains a certain string. this is string is found in that column i would like to select all of the data within them rows. for example in the the data-table the will be a row with "age[10-20]" and based on this input string it should output all of the row the string is "age"
the code below does not return any data there are nor errors
Is it possible to retrieve data based on a index value.
var result = importedExcelData.AsEnumerable().Where(data => data.Field<String>("All Respondents").Contains(first))
Upvotes: 1
Views: 591
Reputation: 6372
Try changing .Where(data => data.Field<String>(first) == first)
to:
.Where(data => data.Field<String>(first).Contains(first)
Upvotes: 2