C
Compunick
On my winform I have a both a Datagrid control and a Textbox control bound
to the same dataset. I used the designtime properties window to bind both
controls to the dataset. Here's my dillema:
When I update a field using the Datagrid, the save routine works.
When I update a field using the Textbox, the save routine does NOT work.
I need to be able to select my current record using the Datagid and then do
the record updates using Textboxes. Can anyone plese HELP!
Here is my save routine:
Me.cnGTS.Open()
Dim UpdatedRows As DataSet
Dim InsertedRows As DataSet
Dim DeletedRows As DataSet
UpdatedRows = Me.DsPERSONNEL1.GetChanges(DataRowState.Modified)
InsertedRows = Me.DsPERSONNEL1.GetChanges(DataRowState.Added)
DeletedRows = Me.DsPERSONNEL1.GetChanges(DataRowState.Deleted)
Try
If Not UpdatedRows Is Nothing Then Me.daPersonnel.Update(UpdatedRows)
If Not InsertedRows Is Nothing Then Me.daPersonnel.Update(InsertedRows)
If Not DeletedRows Is Nothing Then Me.daPersonnel.Update(DeletedRows)
Me.DsPERSONNEL1.AcceptChanges()
Catch eUpdate As System.Exception
MsgBox("Caught exception: " & eUpdate.Message)
End Try
Me.cnGTS.Close()
(e-mail address removed)
to the same dataset. I used the designtime properties window to bind both
controls to the dataset. Here's my dillema:
When I update a field using the Datagrid, the save routine works.
When I update a field using the Textbox, the save routine does NOT work.
I need to be able to select my current record using the Datagid and then do
the record updates using Textboxes. Can anyone plese HELP!
Here is my save routine:
Me.cnGTS.Open()
Dim UpdatedRows As DataSet
Dim InsertedRows As DataSet
Dim DeletedRows As DataSet
UpdatedRows = Me.DsPERSONNEL1.GetChanges(DataRowState.Modified)
InsertedRows = Me.DsPERSONNEL1.GetChanges(DataRowState.Added)
DeletedRows = Me.DsPERSONNEL1.GetChanges(DataRowState.Deleted)
Try
If Not UpdatedRows Is Nothing Then Me.daPersonnel.Update(UpdatedRows)
If Not InsertedRows Is Nothing Then Me.daPersonnel.Update(InsertedRows)
If Not DeletedRows Is Nothing Then Me.daPersonnel.Update(DeletedRows)
Me.DsPERSONNEL1.AcceptChanges()
Catch eUpdate As System.Exception
MsgBox("Caught exception: " & eUpdate.Message)
End Try
Me.cnGTS.Close()
(e-mail address removed)