I’ve a simple code, here I add a row to my a datatable which is in my dataset:
DigiLocalDataSet dataset = new DigiLocalDataSet();
DataRow newClientsRow = dataset.Tables["clients"].NewRow();
newClientsRow ["clientnr"] = "123";
newClientsRow ["name"] = "Pascal";
newClientsRow ["city"] = "London";
dataset.Tables["clients"].Rows.Add(newClientRow);
clientsTableAdapter.Fill(dataset.clients);
this.DataContext = dataset.clients.DefaultView;
But I don’t see the inserted row in my datagrid, I see only the existing rows of the ‘clients’ table.
What’s wrong?
Your call to TableAdapter.Fill is filling your ‘clients’ DataTable with data retrieved from your data source, so you’re losing the record you manually added to the DataTable.