K
Kenneth Baltrinic
I have created a dataset wrapper class that manages the data adapters needed
to fetch and update various tables within a dataset. In this class is the
following method which works fine in several implementations but not in my
current one. Specifically the command builder is not doing anything and
leaving me with undefined action queries. Does anyone know of a cause for
this? The select query is in place and executes fine (i replaced the
da.Update() with a da.Fill() in the below code and it worked without error.)
I get an "Invalid Insert command" error when this code runs and inspecting
the da object reveals that the command is undefined.
protected void rUpdateTable(string sTableName)
{
//Get the stored data adapter from a hash table
OleDbDataAdapter da = (OleDbDataAdapter)pcDataAddapters[sTableName];
OleDbCommandBuilder cb = new OleDbCommandBuilder(da);
// Include an event to fill in the Autonumber value.
OleDbRowUpdatedEventHandler eh = new
OleDbRowUpdatedEventHandler(pOnRowUpdated);
da.RowUpdated += eh;
da.Update(rDataSet, sTableName);
//Unregister event after update completed
da.RowUpdated -= eh;
}
--Ken
to fetch and update various tables within a dataset. In this class is the
following method which works fine in several implementations but not in my
current one. Specifically the command builder is not doing anything and
leaving me with undefined action queries. Does anyone know of a cause for
this? The select query is in place and executes fine (i replaced the
da.Update() with a da.Fill() in the below code and it worked without error.)
I get an "Invalid Insert command" error when this code runs and inspecting
the da object reveals that the command is undefined.
protected void rUpdateTable(string sTableName)
{
//Get the stored data adapter from a hash table
OleDbDataAdapter da = (OleDbDataAdapter)pcDataAddapters[sTableName];
OleDbCommandBuilder cb = new OleDbCommandBuilder(da);
// Include an event to fill in the Autonumber value.
OleDbRowUpdatedEventHandler eh = new
OleDbRowUpdatedEventHandler(pOnRowUpdated);
da.RowUpdated += eh;
da.Update(rDataSet, sTableName);
//Unregister event after update completed
da.RowUpdated -= eh;
}
--Ken