我必須在同一個查詢中選擇另一列,因爲當創建單行時,我必須將該值添加到同一行中。從LINQ中選擇2個值在foreach
//代碼
'Loop through the transactions
For Each iTransactionid In (From TransactionFieldLinq In transactionFieldsCollection Select TransactionFieldLinq.TransactionId).Distinct
'Create a new data row
DataRow = DataTable.NewRow()
'Set the data row properties
DataRow("TransactionId") = iTransactionid
'Loop through the transaction fields collection
For Each TransactionField In (From TransactionFieldLinq In transactionFieldsCollection Where TransactionFieldLinq.TransactionId = CInt(DataRow("TransactionId")))
'Set the data row properties
DataRow(CStr(TransactionField.FieldId)) = TransactionField.FieldValue
Next
'Add the data row to the data table
DataTable.Rows.Add(DataRow)
Next
的transactionFieldCollection
有一個名爲StartDate
另一個屬性是在DateTime
格式和我有相同的查詢選擇也StartDate
列,並將其綁定到DataTable
像TRANSACTIONID。
我該如何做到這一點?
謝謝你幫我..... – iamCR 2013-05-15 07:07:46