Reputation: 117
My windows form application is about Book Store. I would like to display PO numbers in a ComboBox which didn't have create a Good Received Note.
This is the structure of this two tables.
PO Table-
GRN table
How to change following code?
public void fillPOcombo()
{
DynamicConnection con = new DynamicConnection();
con.mysqlconnection();
con.sqlquery("select PO_No from TBL_PO");
con.dataread();
while (con.datareader.Read())
{
cmbpono.Items.Add((int)con.datareader["PO_NO"]);
}
}
Upvotes: 1
Views: 187
Reputation: 3240
I would say as follows :
Change
con.sqlquery("select PO_No from TBL_PO");
to
con.sqlquery("select PO_No from TBL_PO where PO_No not in (select PO_No from GRN)");
Upvotes: 3