Question Fillby method With Related Tables

jtoutou

Active member
Joined
Oct 11, 2008
Messages
26
Programming Experience
Beginner
so...i have a parent table with thousands data ...
there is also a child table there i need to enter data for each row of the parent table..
the two tables are related with Key_Personnel
i'am using the fillby method to filter data.
the fillby method use the lastname for filtering.
Also the two tables are displayed in my form in two different datagridviews.
Normaly in my form_load event i have
VB.NET:
 Me.PersonnelTableAdapter.Fill(Me.StatusJournalDataSet.Personnel)
        Me.Personnel_Status_JournalTableAdapter.Fill(Me.StatusJournalDataSet.Personnel_Status_Journal)
'personnel is the parent and Personnel_Status_journal the child
for the qurey (fillbyLastname) and LastnameTool btn i have
i have
VB.NET:
....
..
.
 Try
           Me.PersonnelTableAdapter.FillByLastname(Me.StatusJournalDataSet.Personnel, LastnameTool.Text)

        Catch ex As System.Exception
            System.Windows.Forms.MessageBox.Show(ex.Message)

        End Try
everything works properly with the datagridviews when showing all the data..
the problem is when i put a letter to filter in the lastnametool text box i get an error from System.Exception
like this:"cannot clear the table personnel because foreign key constraint FK_Personnel_Personnel_Status_jurnal enforces constraints and there are child rows in Personnel_Status_jurnal"
How can i solve this problem
 

Latest posts

Back
Top