Wiki Link: [discussion:1346]
Table Update procedure 

Feb 18 2009 at 12:34 PM
Hi Beth,

I am in the process of moving from Microsoft Access to Visual Basic and found your excellent video series “Forms over Data”. I have set up various tables and am able to display the data as required in their appropriate gridviews without any problem. I am also able to manually update the tables by physically entering the data and edit existing. Yet I am unable to do this via the form. The following is the code. Can you please tell me where I am going wrong?

Public Class BookingDetails

Private Sub ClientsBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClientsBindingNavigatorSaveItem.Click
Me.Validate()
Me.ClientsBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.BookingsDataSet)

End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'BookingsDataSet.FlightBookings' table. You can move, or remove it, as needed.
Me.FlightBookingsTableAdapter.Fill(Me.BookingsDataSet.FlightBookings)
'TODO: This line of code loads data into the 'BookingsDataSet.MediaType' table. You can move, or remove it, as needed.
Me.MediaTypeTableAdapter.Fill(Me.BookingsDataSet.MediaType)
'TODO: This line of code loads data into the 'BookingsDataSet.Employees' table. You can move, or remove it, as needed.
Me.EmployeesTableAdapter.Fill(Me.BookingsDataSet.Employees)
'TODO: This line of code loads data into the 'BookingsDataSet.GroupMembers' table. You can move, or remove it, as needed.
Me.GroupMembersTableAdapter.Fill(Me.BookingsDataSet.GroupMembers)
'TODO: This line of code loads data into the 'BookingsDataSet.Bookings' table. You can move, or remove it, as needed.
Me.BookingsTableAdapter.Fill(Me.BookingsDataSet.Bookings)
'TODO: This line of code loads data into the 'BookingsDataSet.Clients' table. You can move, or remove it, as needed.
Me.ClientsTableAdapter.Fill(Me.BookingsDataSet.Clients)

End Sub

Private Sub BindingNavigator1_RefreshItems(ByVal sender As System.Object, ByVal e As System.EventArgs)

End Sub

Private Sub ClientsBindingNavigator_RefreshItems(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClientsBindingNavigator.RefreshItems

End Sub

André

Feb 21 2009 at 11:31 AM
Edited Feb 21 2009 at 1:37 PM
Hi Beth,

After a lot of swearing and pulling out of hair by the fistful, I have at last found the answer to my question in you video No 10, which I somehow missed the first time round. By selecting copy to output options; Copy if newer did the trick and worked fine.

This now raises another question, or perhaps I have missed this one also and is possibly explained in one of your other videos. How do you synchronise the two sets of databases because when you go back to the Data Connection option and hit refresh, the original data is retained.

May I also make a suggestion; it might be a good idea to include this item in video no 2 or place it between 2 and 3, if you decide to do a revision to your excellent video series. Just a thought.

André (now Baldy)


Updating...
Page view tracker