English 中文(简体)
Convertcu to LINQ tokou
原标题:Convert SQL to LINQ to SQL
  • 时间:2009-08-27 08:44:26
  •  标签:

我在把以下的LQ转换成能够提供帮助的LQ方面遇到很大困难?

SELECT     dbo.ExpensesGroup.ExpenseGroupId, dbo.ExpensesGroup.Title, SUM(dbo.Expenses.Amount) AS TotalAmount, MAX(dbo.Expenses.DateLastTickled) 
                      AS LastTickledDate, MAX(dbo.ExpensesGroup.DateTime) AS Date, Username
FROM         dbo.Expenses INNER JOIN
                      dbo.ExpensesGroup ON dbo.Expenses.ExpenseId = dbo.ExpensesGroup.ExpensesId
WHERE     dbo.Expenses.Status =  AwaitingApproval  or dbo.Expenses.Status =  AwaitingApprovelGrouping 
GROUP BY dbo.ExpensesGroup.ExpenseGroupId, dbo.ExpensesGroup.Title, dbo.Expenses.Username
ORDER BY MAX(dbo.ExpensesGroup.DateTime) DESC, dbo.ExpensesGroup.Title

或者哪怕是任何人都知道LQ转换器的自动SQl?

最佳回答
问题回答

我尝试了linqpad,但并不是要将KQ转换到linq,而是将其实际使用改为Lq,以便查询贵国的数据库。

however I think linqer is the right choice if you like to convert SQL query to LINQ. you can download it from their official site.

http://www.sqltolinq.com/

linqpad没有转换。

自由皈依者

http://windowsphone.interoperabilitybridges.com/articles/sql-to-linq-converter

注:在Windows而不是Windows上与Kingk保持同步 电话

摘自LINQ->K:

        var db = new DBModelDataContext();
        StringBuilder sb = new StringBuilder();
        StringWriter sw = new StringWriter(sb);
        db.Log = sw; //set the writer

        var items = (from rec in db.Table1
                     select rec).ToList();

        var sql = sb.ToString(); //here is the SQL from LINQ.




相关问题
热门标签