I want to select my price level in database to compare with the an integer number. But It is error : Operator \'==\' cannot be applied to operands of type \'System.Linq.IQue
when you have the result from LinQ expression you will always have the list of result set.
So in your code when you are querying as below :
var list_pricelevel = from c in cm.DataContext.Customers
where c.WebAccount == userName
select c.PriceLevel;
The list_pricelevel will be in the form of List ie IQueryable list,
so you have to get only one element to check with one element
so use the below code :
if (list_pricelevel.Single() == 3)
{
Response.Write("Welcome");
}
or
if (list_pricelevel.First() == 3)
{
Response.Write("Welcome");
}
both the above code gives you only one result set value so you can equate with 3 for validation.