Cascading update

VB_nu_B

Member
Joined
Apr 25, 2006
Messages
5
Programming Experience
3-5
Hello VB.net world,

Can someone please explain why none of the attempts below work?

Consider two tables, table1 and table2 in which table2 being the child of table1. The Foreign key relation is over field one of both tables. The relation is set to cascade upon update.
Textbox1 is bound to bindsource1, table1, field1. Textbox2 is bound to FKTable2Table1bindingsource, field2.

Upon update the, the new item is not included in table 2. The changes are observed in the dataset, but not transferred to the original database. The code:

BindingSource1.EndEdit()
changes = Table1TableAdapter.Update(Me.NewDataSet1)


Further, attempts to update table2 throw an exception.

BindingSource1.EndEdit()
changes = Table1TableAdapter.Update_(Me.NewDataSet1.Table1)

FKTable2Table1BindingSource.EndEdit()
Table2TableAdapter.Update(NewDataSet1.Table2)

Attempts to update the specific row also throw an exception.

BindingSource1.EndEdit()
changes = Table1TableAdapter.Update_(Me.NewDataSet1.Table1)

FKTable2Table1BindingSource.EndEdit()
Table2TableAdapter.Update(NewDataSet1.Table2.Rows(1))

Thanks,
Nu_B
 
Dear Vis781,
This is not homework. It is just a puzzle I cannot see through presently and would like some indication as how to proceed.
 
Have you tried doing a Trigger inside of your database to automatically update the new values?

If you are using any enterprise db like Oracle or SQL Server, this is a very good and easier way to do this...
 
Back
Top