Vb.net linq2sql的交叉连接问题
我有以下LINQ2SQL查询:Vb.net linq2sql的交叉连接问题,vb.net,visual-studio-2010,linq-to-sql,Vb.net,Visual Studio 2010,Linq To Sql,我有以下LINQ2SQL查询: From pc In DBContext.ProcessCodes Join c In DBContext.Cells On pc.idCell Equals c.idCell Where pc.idType = "Cars" AndAlso pc.Active = True AndAlso c.Active = True Select c 由于某种原因,当我认为应该得到一个内部连接时,我得到了一个交叉连接
From pc In DBContext.ProcessCodes
Join c In DBContext.Cells On pc.idCell Equals c.idCell
Where pc.idType = "Cars" AndAlso
pc.Active = True AndAlso
c.Active = True
Select c
由于某种原因,当我认为应该得到一个内部连接时,我得到了一个交叉连接(笛卡尔积)。如果我在where中进行多个From的键比较,我会得到同样的结果
我做错了什么?我认为这有助于您:
From pc In DBContext.ProcessCodes
From c In DBContext.Cells
Where pc.idType = "Cars" AndAlso
pc.Active = True AndAlso
c.Active = True
Select c
您的第一步可能是签出生成的SQL。