Hi what's worng with the following code, the chages I made is only
change the DataSet but not the Data-Base:
try
{
DataSet ds = new DataSet();
OleDbDataAdapte r adapter = new OleDbDataAdapte r("Select * from
Employees", @"Provider=Micr osoft.Jet.OLEDB .4.0;Data Source=My.mdb") ;
adapter.Fill(ds , "Employees" );
ds.Tables["Employees"].Rows[0].BeginEdit();
ds.Tables["Employees"].Rows[0]["name"] = "X";
ds.Tables["Employees"].Rows[0].EndEdit();
ds.AcceptChange s();
adapter.Update( ds, "Employees" );
foreach(DataRow row in ds.Tables["Employees"].Rows)
{
Console.WriteLi ne(row["id"] + " " + row["name"]);
}
}
catch(Exception exp)
{
Console.WriteLi ne(exp.Message. ToString());
}
change the DataSet but not the Data-Base:
try
{
DataSet ds = new DataSet();
OleDbDataAdapte r adapter = new OleDbDataAdapte r("Select * from
Employees", @"Provider=Micr osoft.Jet.OLEDB .4.0;Data Source=My.mdb") ;
adapter.Fill(ds , "Employees" );
ds.Tables["Employees"].Rows[0].BeginEdit();
ds.Tables["Employees"].Rows[0]["name"] = "X";
ds.Tables["Employees"].Rows[0].EndEdit();
ds.AcceptChange s();
adapter.Update( ds, "Employees" );
foreach(DataRow row in ds.Tables["Employees"].Rows)
{
Console.WriteLi ne(row["id"] + " " + row["name"]);
}
}
catch(Exception exp)
{
Console.WriteLi ne(exp.Message. ToString());
}
Comment