Hey i just need a little help here,may tables are in a relationship so i want to update both tables so am using datarelation to do that but a get an exception(Column argument cannot be null).please help

OleDbDataAdapter adapter = new OleDbDataAdapter(OledbSql,conn);
                //adapter.SelectCommand = new OleDbCommand(OledbSql, conn);
                OleDbCommandBuilder oleBuilder = new OleDbCommandBuilder(adapter);
                adapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;
                

                //dataAdapter for both objects
                OleDbDataAdapter EmployeeAdapter = new OleDbDataAdapter("SELECT * FROM Employee", conn);
                OleDbDataAdapter BankingAdapter = new OleDbDataAdapter("SELECT * FROM BankingDetails", conn);
                EmployeeAdapter.Fill(ds, "Employee");
                BankingAdapter.Fill(ds, "BankingDetails");

                //datarelation between Employee and Banking Details
                DataRelation HRsystemTableRelation = ds.Relations.Add("EmpBank", ds.Tables["Employee"].Columns["Account_Number"],
                    ds.Tables["BankingDetails"].Columns["Account_Number"]);

>i want to update both tables

Create two dataAdapters, and two commandBuilder objects. (Have you turn on/off Cascade update/delete Ms-Access feature?)

OleDbDataAdapter EmployeeAdapter = new OleDbDataAdapter("SELECT * FROM Employee", conn);

OleDbCommandBuilder cb1=new OleDbCommandBuilder(EmployeeAdapter);


OleDbDataAdapter BankingAdapter = new OleDbDataAdapter("SELECT * FROM BankingDetails", conn);

OleDbCommandBuilder cb2=new OleDbCommandBuilder (BankingAdapter);

EmployeeAdapter.Fill(ds, "Employee");
BankingAdapter.Fill(ds, "BankingDetails");

.....
.....
EmployeeAdapter.Update(ds, "Employee");
BankingAdapter.Update(ds, "BankingDetails");
This article has been dead for over six months. Start a new discussion instead.