I have been trying to create a dynamic query that will check the contents of a datatable. The thing is I the number columns to be selected and also there names are given at runtime. The where clause thus needs to be constructed dynamically. Is there any way to do this in Dynamic linq?
I started with a small eg
string query = "Field<string>(@0)=@1";
fsrch = GetValues();
var result = CapacityTable.AsEnumerable().AsQueryable().Where(query);
I also tried
var result = CapacityTable.AsEnumerable().AsQueryable().Where("Location = @1","Chennai");
In both cases I get an error saying DataRow does not have the specified property. How do I access the columns of the table dynamically????
dynamic-linq
tag because it had the wordsdynamic
andlinq
?