Click here to Skip to main content
15,892,674 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
I have Table HR_Travel(TravelID, TravelCode....) and HR_TravelDocuments(TravelDocID, TravelID, DocUrl)
        FromDate = FromDate.AddDays(1);
        ToDate = ToDate.AddDays(1);
        List<dynamic> Lst = new List<dynamic>();

        var queryTravelDetails = from t in db.HR_TravelDetails
                                 where ((t.StatusDate >= FromDate && t.StatusDate <= ToDate)
                                 && (t.EmpID == EmpID || EmpID == 0) && (t.TravelStatus == TravelStatus || TravelStatus == "All"))
                                 orderby t.StatusDate descending
                                 select new 
                                 {
                                     TravelID = t.TravelID,
                                     TravelSubID = db.HR_TravelDetails.Where(i => i.TravelID == 0).FirstOrDefault().TravelID == null ? 0 : db.HR_TravelDetails.Where(i => i.TravelID == 0).FirstOrDefault().TravelID,
                                     t.TravelCode,
                                     t.EmpID,
                                     EmpName = db.EE_Employee.Where(i => i.EmpID == t.EmpID).FirstOrDefault().EmpName,
                                     t.CellNo,
                                     t.BoardingForm,
                                     t.DestinationTO,
                                     t.JournyDate,
                                     t.Purpose,
                                     t.Organization,
                                     t.TravelStatus,

                                     DocUrl = DocUrl = string.Join(",",( db.HR_TravelDocuments.Where(i => i.TravelID == t.TravelID && i.TravelSubID == 0).Select(i => i.DocUrl).ToList()))
                                 };
foreach (var element in queryTravelDetails) { Lst.Add(element);
}


Gives an error as

LINQ to Entities does not recognize the method 'System.String Join[String](System.String, System.Collections.Generic.IEnumerable`1[System.String])' method, and this method cannot be translated into a store expression.

Plese help me immediately
Posted
Updated 26-Aug-14 2:57am
v2

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