Reputation: 453
i'm getting some value inside a variable and i want to compare it inside my LINQ query. i tried following,
string var_name = Convert.ToString(res[2]);
var result = from p in listData
where p.cd == var_name
select p;
but getting error Embedded statement can not be a declaration or labeled statement
Upvotes: 0
Views: 625
Reputation: 7017
Are you sure that this is connected to LINQ?
Error Embedded statement can not be a declaration or labeled statement
usually means that you are doing something like this:
//WRONG:
if (true)
int i=5;
i++;
In that case you have to change it to:
//CORRECT
if (true)
{
int i=5;
i++;
}
Upvotes: 2