Row Deleting Problem

647
6
07-24-2013 06:20 AM
AbdulrahmanAlqasim
New Contributor
Hi
simply, i want to delete a row from a table. the following code works well . however, after deleting , when i open the attribute table , i can see the row still exists and is not deleted. whene i close Arcmap and start it again , open attribute table, the row is not there.

can any please please guide me to deletion method that works directly with no need to restart arcmap.
thank you


                        IWorkspaceEdit workspaceEdit = (IWorkspaceEdit)dataset.Workspace;
                        workspaceEdit.StartEditing(true);
                        // Start an edit operation and create a cursor.
                        workspaceEdit.StartEditOperation();

                        IRow selectedRow = getSelectedRow();
                        selectedRow.Delete();

                        Marshal.ReleaseComObject(featureCursor);
                        // Stop the edit operation.
                        workspaceEdit.StopEditOperation();
                        // Stop the edit session.
                        workspaceEdit.StopEditing(true);

0 Kudos
6 Replies
LeoDonahue
Occasional Contributor III
Try calling updateContents() on the mxDocument.
0 Kudos
AbdulrahmanAlqasim
New Contributor
Try calling updateContents() on the mxDocument.


hi ldonahue
i just tried that but didn't help.
0 Kudos
LeoDonahue
Occasional Contributor III
post your code please.
0 Kudos
RichardWatson
Frequent Contributor
I am not saying that this is your problem but we reported the following problem:

NIM086472

Calling ITable::GetRow during an edit session returns a row that has been deleted.

We were also issued a hotfix/QFE for this issue on 10.1 SP1.

ESRI reported to us that the problem is fixed in 10.2 (which I believe was released this week).
0 Kudos
AbdulrahmanAlqasim
New Contributor
after long debugging session , i found out that i have to release the cursor inside getSelectedRow() method

Marshal.ReleaseComObject(pFtrCsr1)

thank you guys for trying help me. i appreciate that
0 Kudos
LeoDonahue
Occasional Contributor III
after long debugging session , i found out that i have to release the cursor inside getSelectedRow() method

Marshal.ReleaseComObject(pFtrCsr1)

thank you guys for trying help me. i appreciate that


Glad you figured it out.  However...

"Marshal.ReleaseComObject(pFtrCsr1)"

That doesn't help anyone in the future figure out what you did.  Your existing code sample does not show where that line is or what pFtrCsr1 is.  If you want to help others, post a more complete example.
0 Kudos