|
-
Mar 6th, 2012, 10:34 AM
#12
New Member
Re: [RESOLVED] refresh combobox values after updating its datatable and adapter
I think you guys are missing the big picture. There is a difference between a dataset and the database. A dataset is a copy of the data in the database. If you update the data in the Database's datatable you have to reload the data into the dataset datatable. Also, if you update the data in a dataset, you have to save it using the update method. Otherwise you are only changing the copy of the data, not the data. When you reload the dataset, the data you added will be missing.
This code obviously doesn't work for every scenario, just keep in mind that you have to reload the data from the table before you can see it.
Me.MachinesTableAdapter.InsertMachineName(tbxMachineName.Text)
Me.MachinesBindingSource.EndEdit()
Me.MachinesTableAdapter.Update(Me.FlowMetersDataSet.Machines)
Me.MachinesTableAdapter.Fill(Me.FlowMetersDataSet.Machines)
'Returning From a dialog
Dim Result As DialogResult
Result = dlgNewMachine.ShowDialog()
If Result = DialogResult.OK Then Me.MachinesTableAdapter.Fill(Me.FlowMetersDataSet.Machines)
Last edited by TrippingCobras; Mar 6th, 2012 at 07:14 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|