Getting a Delete Command to work using Dataset & Data Adapter

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.
 
J

Jim P.

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
 
E

Eirik M.

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.
 

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