我需要這個SQL查詢轉換爲LINQ查詢,我也需要公開SQL選擇屬性:轉換這個SQL查詢來LINQ查詢
SELECT Problem.ProblemID, ProblemFactory.ObjectiveID, Objective.Name, ProblemFactory.Time, ProblemType.ProblemTypeName, ProblemFactory.OperationID,
ProblemFactory.Range1ID, ProblemFactory.Range2ID, ProblemFactory.Range3ID, ProblemFactory.Range4ID,
ProblemFactory.MissingNumber
FROM Problem INNER JOIN ProblemFactory ON Problem.ProblemFactoryID = ProblemFactory.ProblemFactoryID
INNER JOIN ProblemType ON ProblemFactory.ProblemTypeID = ProblemType.ProblemTypeID
INNER JOIN Objective ON Objective.ObjectiveID = ProblemFactory.ObjectiveID
更新1:
這是什麼我有:
var query = from problem in dc.Problem2s
from factory
in dc.ProblemFactories
.Where(v => v.ProblemFactoryID == problem.ProblemFactoryID)
.DefaultIfEmpty()
from ...
而且我用這個例子:What is the syntax for an inner join in LINQ to SQL?
好的,那你的問題是什麼?我們不會爲你做你的工作... – cdhowie
我知道,雖然這只是一個疑問。我沒有和LINQ一起工作得很好。我需要一點幫助。問題是我使用三個內部連接,我不知道如何在LINQ中轉換它 – Darf
我更新了文章 – Darf