PDA

Click to See Complete Forum and Search --> : Databinding


BryanJ
Jun 19th, 2002, 01:12 PM
I have a datatable bound to a textbox.

I can perform edit functions and update using the web-service with success. If I add a new record for the first time this is successful but if I try and add another record then I get an error.

What appears to happen is that the dataview in the currency manager does not seem to reflect the changes when I update the datatable and there is an exception thrown due to the database key not being unique.

Is this a possibilty and if so is there a way to force the associated dataview to refresh after the datatable is reloaded from the datasource.

Before Updating I flush the changes to the datatable with,

cm.EndCurrentEdit() 'cm = currency manager

'Updating Function

Private Function update_DB() As Boolean
'Update the database
Dim ds As DataSet
ds = dsAccess 'Retrieve a reference to the exist dataset

Try
If ds.HasChanges Then 'If there are changes
Dim ds_changes As New AvLib.AvWebServer.ds_access() 'Create a dataset of the required typw
ds_changes.Merge(ds.GetChanges()) 'Add the changes to this dataset
ds_changes = ws.UpdateAccessData(ds_changes) 'Send the changes to the source
ds.Merge(ds_changes, False) 'Update the Dataset from source
ds.AcceptChanges() 'Accept all new changes from source
End If
Return True
Catch e As Exception
MsgBox("Updating Error" & e.Message, MsgBoxStyle.Critical, "Software Debugger")
End Try
End Function