In this example, I'm using a connection object named 'master'.
string strSelectA = "SELECT * FROM REF_CSDTransition";
OleDbDataAdapter refAdapter = new OleDbDataAdapter(strSelectA, master);
OleDbCommandBuilder refCommand = new OleDbCommandBuilder(refAdapter);
// The OleDbCommandBuilder will automatically generate the Insert command
for the Update method...
try
{
refAdapter.Fill(ds1, "ref");
}
finally
{
master.Close();
}
// Change your dataset table "ref" here!
try
{
master.Open();
refAdapter.Update(ds1, "ref");
}
finally
{
master.Close();
ds1.Tables["ref"].Dispose();
}
Disposing the "ref" dataset table is not necessary, but I did in this
instance since I am no longer using it at this point.
Good Luck
- carl
PawelR said:
Hi Nicholas,
I use oleDbDataAdapter1.Update(fromAccesDS) and
oleDbDataAdapter1.Update(fromAccesDS.MyTable) and
oleDbDataAdapter1.Update(fromAccesDS.Tables["MyTable"])
and file db1.mdb is not changes.
Meybe I don't understend You. My English is very poor. Please write me
example lines.
Thx
Pawel
Nicholas Paldino [.NET/C# MVP] napisa³:
Pawel,
If you still have the DataAdapter which you used to get the data, then
you can set the Update, Delete and Insert command properties to commands
that should be executed to update the rows in the table. You then call
Update, passing the dataset with the modified data to the method.
Hope this helps.