Michael Roodt
asked on
Update does not update database but does update Dataset
I have a simple SQL database that I've created in visual basic 2008 express edition. I created a new form and created a datasource using the datasource configuration wizard. I then dragged the datasource to the new form that I created and this created a gridview that I'm able to add, update and delete.
During runtime everything works perfectly but if I look in the acutal database table, nothing has changed at all, it almost seems like it's just the datatable that's changing but the changes in the datatable are not being updated to the physical table in the sql database. Am I correct in thinking that the table adapter is meant to take care of this.
The the only other thing I've done that might affect it is the form is brought up by selecting a button, when this button is selected. I create a new instance of the above form i.e.
Dim newIncident As New Incident
newIncident.Show()
This is the code that is automatically generated:
During runtime everything works perfectly but if I look in the acutal database table, nothing has changed at all, it almost seems like it's just the datatable that's changing but the changes in the datatable are not being updated to the physical table in the sql database. Am I correct in thinking that the table adapter is meant to take care of this.
The the only other thing I've done that might affect it is the form is brought up by selecting a button, when this button is selected. I create a new instance of the above form i.e.
Dim newIncident As New Incident
newIncident.Show()
This is the code that is automatically generated:
Private Sub IncidentRecordBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles IncidentRecordBindingNavigatorSaveItem.Click
Me.Validate()
Me.IncidentRecordBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.KEDBDataSet1)
End Sub
Private Sub Incident_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'KEDBDataSet1.IncidentRecord' table. You can move, or remove it, as needed.
Me.IncidentRecordTableAdapter.Fill(Me.KEDBDataSet1.IncidentRecord)
End Sub
I believe you have to commit the changes that were made with .Commit
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
if(Me.KEDBDataSet1.HasChan
Me.IncidentRecordTableAdap