MdiParent DataAdapter.Update

K

Katty

When deleting a row and then updating the dataset I use this code:

Function GetRow(ByVal BindingContext As BindingContext, ByVal _
Dataset As DataSet, ByVal Table As String) As DataRow

Dim bm As BindingManagerBase
Dim drv As DataRowView
bm = BindingContext(Dataset, Table)
drv = CType(bm.Current, DataRowView)
GetRow = drv.Row

End Function

' Deleting:

dr = GetRow(BindingContext, Dataset, "Table")
dr.BeginEdit()
dr.Delete()

' Updating:
Me.DataAdapter.Update(Dataset)

The code works great. However, what I need is to delete a row from
a mdi parent dataset, and then update the data source. I'm using this:

dr = GetRow(BindingContext, CType(Me.ActiveForm, Parent).Dataset, "Table")

dr.BeginEdit()
dr.Delete()

CType(Me.ActiveForm, Parent).DataAdapter.Update(CType(Me.ActiveForm,
Parent).Dataset)

Then I get the error:

System.Data.DBConcurrencyException: "Concurrency violation: the
DeleteCommand
affected 0 records." exception when deleting a row/record from a dataset.

Help, PLEASE
 
K

Katty

got it! I was having a problem related to Autoincrement values. Done.

Thanks anyway... = P
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top