LINQ datasource and BindingNavigator update deosn't work
I'm trying to set a LINQ query as the DataSource of a BindingNavigator control.
开发者_开发百科In the form's variables I added a data context:
`Private c
tx As New myDataManagerDataContext`
The following code allows me to display and navigate through the results:
Dim clubList = From c In ctx.clubs _
Select c
BindingNavigator1.BindingSource.DataSource = clubList
Each record is displayed nicely so far. In the Winform, all textboxes are duly binded to the datasource but my problem is:
I added a Save ToolboxButton with: ctx.SubmitChanges()
But it doesn't process any update!
Question: Do I HAVE to write a complete Insert/ Update Linq procedure in the Save button?
Like:
Dim newClub as new DataContext.Club
newClub.Name = NameTextBox.Text
newClub.Address.... Etc.
Try to call EndEdit on binding source just before save operation to happen.
精彩评论