D
Dathan
Hello, all.
I've created a data set using the designer in Visual Studio 2005, with
C# as the target language. I get a data set, a bunch of custom data
tables, and a bunch of table adapters.
I have a main form MainForm. It keeps a "master" data set for the
application. To simplify the interface, I spawn child forms, and
create copies of the appropriate portions of the data set in each
child form. Something like:
ChildForm1 new_form = new ChildForm1();
// copy data to the child form
new_form.DataSet.DataTable1.Load
(this.DataSet.DataTable1.CreateDataReader());
new_form.ShowDialog();
// when the user's done with the child form, merge changes back into
the master
this.DataSet.DataTable1.Load
(new_form.DataSet.DataTable1.CreateDataReader(), LoadOption.Upsert);
..
..
..
// when we're closing the application, or when "commit" button is
pressed, commit data changes to the database
this.dataTable1Adapter.Update(this.DataSet.DataTable1);
This works fine for updating existing rows and adding new rows, but
will not commit row deletions to the database. The code I'm using to
delete rows is (within ChildForm1):
((DataRowView)this.dataTable1BindingSource.Current).Delete();
where dataTable1BindingSource is created by the designer when set
DataTable1 as the DataSource for a listbox within ChildForm1.
Can someone point me in the right direction?
Thanks!
~Dathan
I've created a data set using the designer in Visual Studio 2005, with
C# as the target language. I get a data set, a bunch of custom data
tables, and a bunch of table adapters.
I have a main form MainForm. It keeps a "master" data set for the
application. To simplify the interface, I spawn child forms, and
create copies of the appropriate portions of the data set in each
child form. Something like:
ChildForm1 new_form = new ChildForm1();
// copy data to the child form
new_form.DataSet.DataTable1.Load
(this.DataSet.DataTable1.CreateDataReader());
new_form.ShowDialog();
// when the user's done with the child form, merge changes back into
the master
this.DataSet.DataTable1.Load
(new_form.DataSet.DataTable1.CreateDataReader(), LoadOption.Upsert);
..
..
..
// when we're closing the application, or when "commit" button is
pressed, commit data changes to the database
this.dataTable1Adapter.Update(this.DataSet.DataTable1);
This works fine for updating existing rows and adding new rows, but
will not commit row deletions to the database. The code I'm using to
delete rows is (within ChildForm1):
((DataRowView)this.dataTable1BindingSource.Current).Delete();
where dataTable1BindingSource is created by the designer when set
DataTable1 as the DataSource for a listbox within ChildForm1.
Can someone point me in the right direction?
Thanks!
~Dathan