This is Datagridview which I need to display on the screen like these.
(Datagrid view is binding with the "main table" (RECEIVE_PLAN))
Concept Design database:
if you want to import something into warehouse, you must plan for receiving in a day. Receiving Plan is made from "Purchase Order" directly Or sometime your warehouse has a receiving schedule before ordering.
Database has three tables, including Table A and Table B and Main Table.
They have a relation like these.
Note: the main table has two options for getting value for display to the screen
get "PO_LIST_NO" and "PO_NO" from A table(PURCHASE ORDER table) directly.
get "PO_LIST_NO" and "PO_NO" from B table(RECEIVE SCHEDULE table) then get value from A table.
Important Conditions
In main table (RECEIVE PLAN) must have a value in either "PO_ID" or "RS_ID"
If main table (RECEIVE PLAN) has a value at PO_ID column, RS_ID column must be NULL. On the other hand, If main table (RECEIVE PLAN) has a value at RS_ID column, PO_ID column must be NULL
Main Table (RECEIVE PLAN) must not NULL both PO_ID and RS_ID
Main Table (RECEIVE PLAN) must not has a value at both PO_ID and RS_ID
RECEIVE PLAN's example like below.
(PO_TRAN_ID) is PO_ID
(RS_TRAN_ID) is RS_ID in this case.
QUESTION :How to query for getting value from either Table A or B?
How to join between a main table,A and B table for display like these.
This datagridview Properties.
BindingSource : main table (RECEIVE_PLAN)
"PO LIST NO" column : getting from A table (PURCHASE_ORDER)
"PO NO" column : getting from A table (PURCHASE_ORDER)
"PLAN QTY" column : getting from main table (RECEIVE PLAN)