Could you, please, help me to solve this:
dAdapter.Update(dTable);
when my dTable depends on user choice. I have one Dataset with several tables, and name of the chosen Table apears in Label1.Text.
How to save changes from dataGridView to Database? The problem is that bindigSource.DataMember is known only in runtime, when user select the Table Name.
I have tried following code:
private void saveToolStripButton_Click(object sender, EventArgs e) { OleDbDataAdapter da = new OleDbDataAdapter(); BindingSource bindingSource1 = new BindingSource(); bindingSource1.DataMember = label1.Text; bindingSource1.DataSource = dataGridView1.DataSource; this.Validate(); this.bindingSource1.DataSource = ds; this.bindingSource1.DataMember = label1.Text; DataTable dt = bindingSource1.DataSource as DataTable; this.bindingSource1.EndEdit(); if (dt != null) { this.tableAdapterManager.UpdateAll(ds); } }