I've two related DataGridViews for prod_category & prod_sub_category tables. I've used a text box to run FillBy method on prod_category table adapter to search records. But when I press any key in the search text box I get "Cannot clear table prod_category because ForeignKeyConstraint prod_categoryprod_sub_category enforces constraints and there are child rows in prod_sub_category" error.
VB.NET:
Private Sub txtSubCatg_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtSubCatg.KeyDown Try
Me.Prod_sub_categoryTableAdapter.FillBy(Me.SalesDataSet.prod_sub_category, txtSubCatg.Text)
Catch ex As System.Exception
System.Windows.Forms.MessageBox.Show(ex.Message)
End Try
End Sub