I have had several posts on here trying to figure this out. I am a little closer, but still can't figure this out. I am on my last nerve trying to figure this out. I know I am so close. The following two pictures show the part of the dataset diagram that relates to this and the other is a picture of the form i am working with. The details on the left of the form are from my main table, the grid on the left is the child table. As you can see, i get the -1 temp key on the left, which then flows down to the child form. I cant seem to get the child rows to save when i click the save button.
Form:
Dataset Designer:
As you can see, it is a many to many relationship between flightplan and charge numbers.
Code when clicking save:
The error i get on the updateall line is:
The INSERT statement conflicted with the FOREIGN KEY constraint "fk_flightcharge". The conflict occurred in database "FlightTestApp2", table "dbo.flightplan", column 'flightplan_id'.
The statement has been terminated.
What am I doing wrong? How does the flightplan_id trickle down to the grid. It should be done through the relation, correct?
Can anyone help me get this working, I just cant figure it out. Any help will be greatly appreciated. Small compensation to anyone that can help me get this working the way i need.
Form:
Dataset Designer:
As you can see, it is a many to many relationship between flightplan and charge numbers.
Code when clicking save:
VB.NET:
Private Sub FlightplanBindingNavigatorSaveItem_Click(sender As System.Object, e As System.EventArgs) Handles FlightplanBindingNavigatorSaveItem.Click
Me.Validate()
Me.FlightplanBindingSource.EndEdit()
Me.FlightchargeBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.FlightTestApp2DataSet)
End Sub
The error i get on the updateall line is:
The INSERT statement conflicted with the FOREIGN KEY constraint "fk_flightcharge". The conflict occurred in database "FlightTestApp2", table "dbo.flightplan", column 'flightplan_id'.
The statement has been terminated.
What am I doing wrong? How does the flightplan_id trickle down to the grid. It should be done through the relation, correct?
Can anyone help me get this working, I just cant figure it out. Any help will be greatly appreciated. Small compensation to anyone that can help me get this working the way i need.