2011-05-05 71 views
-1

在我的分貝,我有4個表員工,客戶,產品&訂單。LINQ到SQL錯誤

我嘗試的LINQ to SQL寫下了下面的表達式:

NorthwindDataContext db = new NorthwindDataContext(); 
var matchingEmployees = from employee in db.Employees 
         where employee.emp_city = "pune" 
         select employee; 

,但它反映了以下錯誤:

Error 1 Cannot implicitly convert type 'string' to 'bool'

我已經給emp_city as nvarchar(50) 如何解決這個問題

回答

4
NorthwindDataContext db = new NorthwindDataContext(); 
var matchingEmployees = from employee in db.Employees 
         where employee.emp_city == "pune" // == not = 
         select employee;