Click here to Skip to main content
15,882,329 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have list having all information of employee eg
List<employee> lstEmployee = Employee.GetAll();
... now i have to update employee name how i do this by using linq....?

Try this:
Follow the steps:
1. Create the object of your DataContext.
2. Get the row of the table which you want to update.
3. Update the values in the required columns.
//context is the object of your datacontext
var dbEmpInfo = context.Employee
    .Where(w => w.EmployeeID == 101)

if (dbEmpInfo != null)
    dbEmpInfo.FirstName = "Amit";

You should try searching Google[^] also.

Share this answer
now you should update -
foreach (var elementEmp in lstEmployee)
//perform your update query here.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900