convert IQueryable to

前端 未结 6 803
滥情空心
滥情空心 2020-12-16 18:01

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

6条回答
  •  醉酒成梦
    2020-12-16 18:58

    Here is my suggestion:

     if (list_pricelevel.First() == 3) 
     { 
          Response.Write("Welcome");  
     }
    

    This may rise a NullReferenceException in case there is no item in Customers satisfying where c.WebAccount == userName.

    Explanation:

    list_pricelevel is a IEnumerable of items satisfying your where clause.

提交回复
热议问题