0
//SELECT table1.GG_ITEM, Sum(table1.REM_QTY) AS SumPerGG_ITEM
//FROM table1
//WHERE (table1.SUGG_DOCK_DATE Is Not Null)
//GROUP BY table1.GG_ITEM
//ORDER BY table1.GG_ITEM;
var try1 = (from row in db2.Dumps select new { Type1 = row.GA_ITEM, Type2 = row.REM_QTY });
Debug.Print(":::::try1:::::");
foreach (var row in try1)
{
Debug.Print(row.Type1.ToString());
Debug.Print(row.Type2.ToString());
}
var try2 = (from row in db2.Dumps group row by row.GA_ITEM into g select new { Type1 = g.Key, Type2 = g.ToList() });
Debug.Print("::::try2:::::");
foreach (var row in try2)
{
Debug.Print(row.Type1.ToString());
Debug.Print(row.Type2.ToString());
}
我正在將Access SQL查詢轉換爲Linq。我從我的表Dumps選擇的兩列是GA_ITEM
和REM_QTY
。我的try1
工作得很好,我看到兩欄的內容都打印出來了。我的try1
尚未複製Access SQL查詢的功能。我的try2
是一個分組嘗試。對於我try2
row.Type1.ToString()
是可讀然而row.Type2.ToString()
是顯示了在輸出窗口:通過查詢創建Linq組
System.Collections.Generic.List`1[garminaspsandbox3.Models.Dump]
我真正希望做的是try2選擇GA_ITEM
和REM_QTY
就像我在try1和組未通過GA_ITEM但是這些領域沒有出現在我的g對象的自動完成中。
有沒有人知道如何在Linq做到這一點?
感謝您張貼...