Hope this helps.
//Code
'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 transactions for start date
For Each dtStartDate In (From TransactionFieldLinq In transactionFieldsCollection Where TransactionFieldLinq.TransactionId = iTransactionid And TransactionFieldLinq.StartDate <> CDate("12:00:00 AM") Select TransactionFieldLinq.StartDate)
'Set the data row properties
DataRow("StartDate") = dtStartDate
Next
'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
If (TransactionField.FieldId <> 0) Then
DataRow(CStr(TransactionField.FieldId)) = TransactionField.FieldValue
End If
Next
'Add the data row to the data table
DataTable.Rows.Add(DataRow)
Next