XSD dataset fails to delete table hierarchy

  • Thread starter Thread starter Keith Patrick
  • Start date Start date
K

Keith Patrick

I have a set of 3 tables in my DB and defined in an XSD: QueryCommand,
which has one or more QueryColumns and QueryFields. QueryFields are related
to themselves by primaryKey-ParentQueryFieldId. Updates and deletes on all
the relationships are cascade, and all IsNested's are set to "false"
(setting it to true prevented child rows being written, or in the case of
QueryField-QueryField, it wasn't updating the parentIDs in the children once
the parent was written to the DB, resulting in ref integrity getting screwed
up.
Right now, the problem I am having is deleting a QueryCommand. By calling:
queryCommandRow.Delete()

results in this error: -> DeletedRowInaccessibleException (Cannot delete
this row since it's already deleted)

Doesn't matter if I wrap the call in BeginEdit()/EndEdit(), either (which I
find extremely confusing because the documentation claims that turns off
validation).

Does anyone have ANY ideas on what I'm doing wrong, because I've been at
this for days and am about ready to see how far I can throw my keyboard and
how many pieces I can reduce it to?
 
For the Googlers out there, a fix was to replace cascading deletes on
QueryField(parent)-QueryField(child) in the XSD, but keep it in the DB.
That way, the typed dataset doesn't try to delete child fields as part of
the clearing of the records (to clear a parent row that comes befor the
child in the DB, it cascade deletes, but the thing doesn't realize that the
next row was already deleted as part of the cascade, so it tries to delete
it from the dataset again (at least that's what appears to be going on))
 
Back
Top