我想根據用戶選擇動態過濾記錄。用戶可以選擇顯示大於借方的借方金額或高於借方的貸方金額。因此我想提出一個條件相似,無論是totDebit>totCredit or
TotCredit> totDebit`linq查詢動態添加條件?
Dim query = _
From product In Bills.AsEnumerable() _
Group product By accode = product.Field(Of String)("ACCODE"), _
BILLNO = product.Field(Of String)("BILLNO") Into g = Group _
Let totDebit = g.Sum(Function(proudct) proudct.Field(Of Decimal)("DEBIT")) _
Let totCredit = g.Sum(Function(proudct) proudct.Field(Of Decimal)("CREDIT")) _
Select New With _
{ _
.ACCODE = accode, _
.billno = BILLNO, _
.TOTALDEBIT = totDebit, _
.TOTALCREDIT = totCredit, _
.BALNACE = totDebit - totCredit _
}
如何才能做到這一點?