I have the following tables: 1. Company (Parent) 2. MemberInfo (Parent) 3. Address Mem(Child to 1 and 2 above)
In the AddressMemBO I have a relationship define for the MemberInfo (put the relation info here) I have a form where I want to use AddressMemBO related to Company so the correct AddressMemBO.Company_FK) can be updated automatically, I am trying to use the BO.RegisterForeingKey method to archive this with the following code:Private Sub CompanyBO1_ParentFormLoading() Handles CompanyBO1.ParentFormLoading Me.CompanyBO1.RegisterForeignKey(Me.AddressMemBO1, "Company_FK") Me.CompanyBO1.FillAllRecords() If Me.CompanyBO1.Count > 0 Then Me.AddressMemBO1.FillByParentPrimaryKey(Me.CompanyBO1.Company_PK) End If Me.lstAddress.Requery()End SubThe above code is not working, the BO.FillByParentPrimaryKey() is not returning any record, where I am sure there are related records in the database, also when adding a new AddressMem record, the Company_FK is not being updated.Now if I change in the AddressMemBO class relationship via the class to it will be with Company table instead of MemberInfo, it will work just fine. (One relation at the time).
If Me.CompanyBO1.Count > 0 Then Me.AddressMemBO1.FillByParentPrimaryKey(Me.CompanyBO1.Company_PK) End If
Me.lstAddress.Requery()End Sub
So what am I missing in the use of BO.RegisterForeingKey?Thanks,Doron
The
'-- Create the parms cmd.Parameters.Add("@parentPk", SqlDbType.BigInt).Value = parentPk cmd.Parameters.Add("@parentType", SqlDbType.Int).Value = parentType
'-- Populate the BO Me.FillDataTable(cmd)
End Sub
Your suggestion worked just fine. But it will be nice if I can use the wizard to add un limited relations instead of adding the relation by code. Is that on the work for the next version? In a way this is like small DD where the relation is defined and it is easier to see or manage all relations with this little graphical interface.
Thanks,
Doron
I hope you will get to it sometimes soon.
Regards,