将此查询转换为LINQ转换为SQL [英] convert this query to LINQ to SQL
本文介绍了将此查询转换为LINQ转换为SQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨
请帮我.
我无法将此查询在LINQ中转换为SQL:
Hy
pleas help me .
I cant convert this query in LINQ to SQL :
SELECT dbo.ReportType.Name FROM dbo.Center
INNER JOIN dbo.SwitchType ON dbo.Center.Switch = dbo.SwitchType.ID
RIGHT JOIN dbo.ReportType ON dbo.Center.ID = dbo.ReportType.ID
推荐答案
像下面这样编写查询.
var结果=来自dbo.Center中的a
INNER JOIN开关dbo.SwitchType ON a.Switch = switch.ID
右加入报告dbo.ReportType ON a.ID = report.ID
有关更多信息,请参见下面的链接.
C#中的简单LINQ to SQL [
Hi,
Write your query like below.
var result = from a in dbo.Center
INNER JOIN switch dbo.SwitchType ON a.Switch = switch.ID
RIGHT JOIN report dbo.ReportType ON a.ID = report.ID
For more information please refer the below link.
Simple LINQ to SQL in C#[^]
你好,
您可以尝试以下代码.可能会对您有帮助.
Hi,
you can try the following code. It might be help you.
var ds = from p in dbo.Center
INNER JOIN dbo.SwitchType ON p.Switch equals SwitchType.ID
RIGHT JOIN dbo.ReportType ON p.ID equals ReportType.ID
SELECT NEW {Name}
这篇关于将此查询转换为LINQ转换为SQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文