0

Possible Duplicate:
Parse string into a LINQ query

Iam trying to build a linq query, from string but confused.

From the below query string MyRptStrng is having the conditions...

string MyLnqBuildStr="(from DataRow DR1 in MyEmpTbl.AsEnumerable() orderby Convert.ToInt32(DR1['emp_no']) where " + ???????MyRptStrng + " select DR1).ToList()";


var GRNMultiRslt = MyLnqBuildStr;

DataTable GRNPrtDTB = GRNMultiRslt.CopyToDataTable(); 

And Iam getting the error - char cannot be used as type parameter 'T' in generic type...

Thanks

Community
  • 1
  • 1
LOGAN
  • 35
  • 1
  • 6

1 Answers1

2

This won't work. At all. You can't (in any easy way) execute a string that contains a query expression. Perhaps you want to use SQL instead?

Jason Malinowski
  • 18,148
  • 1
  • 38
  • 55