I am populating a DataGrid with the following LINQ code :
Dim myClients = From p In dc.Persons _
Select p
I can navigate my DataGrid, make changes and then click on a button that calls
dc.SubmitChanges()
All of this works well and updates SQL Server.
I then wanted to add a single additional column that would display a calculated age based on a Function. I used the following code to create a PersonAge column and it worked.
Dim myClients = From p In dc.Persons _
Select New With {p.PersonID, _
p.PersonName, _
p.PersonGender, _
.PersonAge = CalcCurrentAge(p.PersonDOB, p.PersonFirstContactDate, p.PersonFirstContactAge) _
}
However, I noticed that I can no longer successfully save any updates back to SQL.
So my question is, how can I take the simplicity of the first LINQ code which saves updates correctly, and mix it with the second LINQ code which includes the PersonAge column to create an updatable DataGrid with a calculated age column?