I am new to sharepoint and i am using Linq to Sharepoint in my project. I have two Lists in TestSite. Details are as below
Department
DepartmentName Single line of text
ManagerId Person or Group
IsActive Choice
LeaveDetails
EmployeeId Person or Group
LeaveDescription Multiple lines of text
ApprovalStatus Choice
FromDate Date and Time
ToDate Date and Time
LeaveTypeId Lookup
DepartmentId Lookup
AppliedDate Date and Time
AssignedTo Person or Group
RejectionReason Multiple lines of text
I am trying to join these two list. By doing some googling on it i have created following Linq query but in the result it is showing Enumeration yielded no results.
the code is as below :
SPList lstDept = SPContext.Current.Web.Lists["Department"];
SPList lstLeaveDetails = SPContext.Current.Web.Lists["LeaveDetails"];
var v = from SPListItem ld in lstLeaveDetails.Items
join SPListItem dept in lstDept.Items on ld["DepartmentId"] equals dept.Title
select new
{
Emp = ld.Title,
Id = dept.ID
};
So, can any one tell what i am doing wrong?