using (SmartEntities employeeverificationcontext = new SmartEntities())
{
Employee emp = (from c in employeeverificationcontext.EmployeeEntity
where c.Employee_ID == emp_detail.EmployeeID
select new Employee {c.Status}).FirstOrDefault();
emp.Status = emp_detail.Status;
int i=employeeverificationcontext.SaveChanges();
if (i > 0)
{
result = "Verification Process Completed";
}
}
error: Error 1 Cannot initialize type 'SmartWCF.Employee' with a collection initializer because it does not implement 'System.Collections.IEnumerable'**LINQ到實體選擇查詢錯誤
我這樣做,但它選擇所有我只是想選擇狀態列列... Thnks幫助表示讚賞。 –
@PushkarJethwa,您只能選擇狀態欄,用''沒有新Employee'選擇c.status'。您無法投射到實體框架中的實體類型。但是選擇狀態並不能幫助你在後面的代碼中做什麼。您將無法設置'emp.Status = emp_detail.Status' – Habib