MadIce
asked on
Update Datatable with the results of a LINQ query
Not sure how/or best way to do this. I have a datatable with part of the data needed (look at code). The code works. But now I want to run another LINQ query something like this
Dim TList = From TL In dc.vwTL
Select TL.DOD, TL.Test
and now update my Datatable with the TL.Test info. I actually have many other columns that will need to update the datatable the same way to include calculations. Using VB 2008 framework 3.5. had a simular question. Thanks in advance
Dim TList = From TL In dc.vwTL
Select TL.DOD, TL.Test
and now update my Datatable with the TL.Test info. I actually have many other columns that will need to update the datatable the same way to include calculations. Using VB 2008 framework 3.5. had a simular question. Thanks in advance
Dim TMDODList = From TM In dc.vwCurrent_datTMs _
Select TM.DOD
ResultsTable = New DataTable("Results")
'Create the cols for the table
ResultsTable.Columns.Add("DOD", GetType(String))
ResultsTable.Columns.Add("Test", GetType(Integer))
For Each DOD In TMDODList
ResultsTable.Rows.Add(New Object() {DOD})
Next
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I had to adjust code for nullable value but answer is just what I was looking for.
If T.Test.HasValue Then ResultsTable.DefaultView.I tem(0).Ite m("Test") = T.test
Thanks alot. Was getting ready to go back to using Store Procedure
If T.Test.HasValue Then ResultsTable.DefaultView.I
Thanks alot. Was getting ready to go back to using Store Procedure
ASKER
It looks like your example will work but I get an error on the the second line (for the Rowfilter).
The error is "Cannot find Column(A1).
A1 is the value for the first DOD. I need to filter on DOD not Test. It seem like that should work. Any Ideas