Getting a Delete Command to work using Dataset & Data Adapter

  • Thread starter Thread starter Jim P.
  • Start date Start date
J

Jim P.

I'm using an Infragistics UltraWinGrid. After deleting the ActiveRow from
the Grid, I get the following message:

----------------------------------------------------------------------------
-------------
An unhandled exception of type 'System.InvalidOperationException' occurred
in system.data.dll

Additional information: Update requires a valid DeleteCommand when passed
DataRow collection with deleted rows.
----------------------------------------------------------------------------
-------------

So I attempted to manually delete the row from the data table after it was
deleted from the Grid.
dataSet_uGrid.tblItems.Rows[rowID].Delete();
dataAdapter_uGrid.Update(dataSet_uGrid, "tblItems");

But still get the same error message.

Why is this so hard to commit the Delete Command to the database??

thanks.
 
I checked the RowState of my Row that I deleted and the State is set to
Delete,where all others are Unchanged. So do I need to create my own
DeleteCommand (to perform some function) before I Update the dataAdapter?
Why is it asking for a valid DeleteCommand?

thank,
Jim
 
Jim P. said:
I checked the RowState of my Row that I deleted and the State is set to
Delete,where all others are Unchanged. So do I need to create my own
DeleteCommand (to perform some function) before I Update the dataAdapter?
Why is it asking for a valid DeleteCommand?

How else would the DataAdapter know how to delete something in your DB?

Eirik M.
thank,
Jim


Jim P. said:
I'm using an Infragistics UltraWinGrid. After deleting the ActiveRow from
the Grid, I get the following message:

--------------------------------------------------------------------------
--
-------------
An unhandled exception of type 'System.InvalidOperationException' occurred
in system.data.dll

Additional information: Update requires a valid DeleteCommand when passed
DataRow collection with deleted rows.
--------------------------------------------------------------------------
--
-------------

So I attempted to manually delete the row from the data table after it was
deleted from the Grid.
dataSet_uGrid.tblItems.Rows[rowID].Delete();
dataAdapter_uGrid.Update(dataSet_uGrid, "tblItems");

But still get the same error message.

Why is this so hard to commit the Delete Command to the database??

thanks.
 
Back
Top