W
wayne
I'd appreciate feedback on whether it is possible to update a database
using a DataRow object rather than a DataTable.
Suppose I have the following code:
OleDbConnection conn = new OleDbConnection(m_Dsn);
OleDbDataAdapter adapter = new OleDbDataAdapter();
adapter.UpdateCommand = new OleDbCommand("sp_UpdatePageItem", conn);
// ....
adapter.Update( dtMyDataTable );
This is okay providing I have a reference to whole DataTable to update.
Suppose I only have a reference to a single DataRow object which has
been modified and needs to have it's changes sent to the database. The
following works:
adapter.Update( drMyDataRow.Table );
but it will also cause other modified rows to be updates. I only want
the DataRow I jave a reference to have it's changes sent.
Am I right in thinking the only way is to use:
adapter.Update( new DataRow[] { drMyDataRow} );
Comments appreciated
Wayne.
using a DataRow object rather than a DataTable.
Suppose I have the following code:
OleDbConnection conn = new OleDbConnection(m_Dsn);
OleDbDataAdapter adapter = new OleDbDataAdapter();
adapter.UpdateCommand = new OleDbCommand("sp_UpdatePageItem", conn);
// ....
adapter.Update( dtMyDataTable );
This is okay providing I have a reference to whole DataTable to update.
Suppose I only have a reference to a single DataRow object which has
been modified and needs to have it's changes sent to the database. The
following works:
adapter.Update( drMyDataRow.Table );
but it will also cause other modified rows to be updates. I only want
the DataRow I jave a reference to have it's changes sent.
Am I right in thinking the only way is to use:
adapter.Update( new DataRow[] { drMyDataRow} );
Comments appreciated
Wayne.