Joining two tables using LINQ

后端 未结 6 1137
一向
一向 2020-12-19 11:26

I have two tables:

PlanMaster (PlanName, Product_ID)

and

ProductPoints (Entity_ID, Product_ID, Comm1, Com

相关标签:
6条回答
  • 2020-12-19 11:43
    var td =
        from s in cv.Entity_Product_Points
        join r in dt.PlanMasters on s.Product_ID equals r.Product_ID
        where s.Entity_ID == getEntity
        select s;
    

    = not equal to ==

    0 讨论(0)
  • 2020-12-19 11:43
    var db1 = (from a in AccYearEntity.OBLHManifests select a).ToList();
    var db2 = (from a in MasterEntity.UserMasters select a).ToList();
    
    var query = (from a in db1
                 join b in db2 on a.EnteredBy equals b.UserId
                 where a.LHManifestNum == LHManifestNum
                 select new { LHManifestId = a.LHManifestId, LHManifestNum = a.LHManifestNum, LHManifestDate = a.LHManifestDate, StnCode = a.StnCode, Operatr = b.UserName }).FirstOrDefault();
    
    0 讨论(0)
  • 2020-12-19 11:56

    where s.Entity_ID = getEntity should be where s.Entity_ID == getEntity.

    0 讨论(0)
  • 2020-12-19 11:58

    Try changing it to

     where s.Entity_ID == getEntity
    
    0 讨论(0)
  • 2020-12-19 11:58

    I think this will do,

    where s.Entity_ID == getEntity

    0 讨论(0)
  • 2020-12-19 12:04

    Shouldn't that be a double equals?

    0 讨论(0)
提交回复
热议问题