JaedenRuiner
Well-known member
- Joined
- Aug 13, 2007
- Messages
- 340
- Programming Experience
- 10+
Well,
With the nature of relational databases, there are often Primary Keys and Foreign Keys, and in the past I have not had to utilize programming to work with databases, but direct SQL access points, etc. (Sql*Plus, etc).
I've come quite a ways since then and have my DB designed, all my relationship ducks are in their rows, and the forms are all designed, but I noticed something that made me question a little logistical handling with regards to ForiegnKeys.
Database
On the form I have a DGV, which is bound to a BindingSource:
Pretty straight forwards. On the same form, i have a secondary DGV but this is the point of contention:
Which is the best method to use for the linkage of the dgv_BOL to the current selection in the dgv_Customers:
I notice this initially, and was curious if the FK assignment to the DataMember will automatically follow the parent bind source or not. (Currently I am using a BindingNavigator to manipulate the different bind_Sources etc, i'm just curious as to the proper usage of that FK_* entry within a Parent BindingSource)
Thanks
With the nature of relational databases, there are often Primary Keys and Foreign Keys, and in the past I have not had to utilize programming to work with databases, but direct SQL access points, etc. (Sql*Plus, etc).
I've come quite a ways since then and have my DB designed, all my relationship ducks are in their rows, and the forms are all designed, but I noticed something that made me question a little logistical handling with regards to ForiegnKeys.
Database
VB.NET:
tbl_Customers
Cust_ID PK
Name nvarchar(50)
tbl_BOL
BOL_ID PK
Customer (FK_tblBOL_tblCustomers : Cust_ID -> Customer)
On the form I have a DGV, which is bound to a BindingSource:
VB.NET:
private _dsMyDB
private dgv_Customers
private bind_Customers
bind_Customers.DataSource = _dsMyDB
bind_Customers.DataMember = "tbl_Customers"
dgv_Customers.DataSource = bind_Customers
Pretty straight forwards. On the same form, i have a secondary DGV but this is the point of contention:
VB.NET:
private dgv_BOL
private bind_BOL
bind_BOL.DataSource = _dsMyDB
bind_BOL.DataMember = "tbl_BOL"
Which is the best method to use for the linkage of the dgv_BOL to the current selection in the dgv_Customers:
VB.NET:dgv_BOL.DataSource = bind_BOL sub dgv_Customer_OnRowSelect() bind_BOL.Filter = "Customer = '" & CurrentRowCustId & '" end sub
- Or
VB.NET:dgv_BOL.DataSource = bind_Customer dgv_BOL.DataMember = FK_tblBOL_tblCustomer
I notice this initially, and was curious if the FK assignment to the DataMember will automatically follow the parent bind source or not. (Currently I am using a BindingNavigator to manipulate the different bind_Sources etc, i'm just curious as to the proper usage of that FK_* entry within a Parent BindingSource)
Thanks