Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
5
Reply
Issue on use where condion in mvc 4 with entity frameworkk
Ram Pradeep
Nov 10 2015 3:44 AM
366
Reply
Actually i am trying to get the employees information based on the deptno.
My Tables:
1.tblemployee2-->colomns-->Id,name,email,sal,deptid
2.tbldept2-->colomns-->deptid,deptname.
here 2 tables has the relation with foreign key constraint.
now i want to retrieve employee names whose deptid is matching with deptid of tbldept2 table.I am getting error in controller
public class employeeController : Controller
{
//
// GET: /employee/
public ActionResult Index(int id)
{
employeecontext empcontext = new employeecontext();
employee emplist = empcontext.employees.Where(emp => emp.DEPTID == id);
return View(emplist);
}
public ActionResult Details()
{
employeecontext employeecontext = new employeecontext();
List<employee> empnames= employeecontext.employees.ToList();
return View(empnames);
}
}
solve this .....
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
5
)
Next Recommended Forum
Stored Procedure taking longer time in code then in sql
Crystal Report inside Master Page