Displaying specific data in datagridview on basis of run time query.
I have got a datagridview on my windows form in VB.NET 2005. The data grid's data source is WR130BindingSource. I have dragged a combo box from WCDESC_I in WC931 table.
My problem is I want the datagrid to display only that specific data (only five columns while the table contains 20 columns) from WR130 table when the user selects a WCDESC_I from WC931.
So what happens is when user selects WCDESC_I from combobox, I find the WCID_I of that row and from this WCID_I found from WC931, I need to find all the records in WR130 which contain the same WCID_I.
Further more, I have to also display the data where DONE_CB in WR130 table is not equal to 1.
Also, I have to filter the data to be displayed in the data grid on basis where WO32.ORDERSTATUS = 3 OR 7. Which means first |I have to find all the MoNumbers in WO32 whose OrderStatus is either 3 or 7. Then I have to find all those MoNumbers in WR130 and then display them.
WC931 and WR130 have WCID_I in common.
WO32 and WR130 have MoNumber in common.
So when the user selects, WCDESC_I from the combo box, I need this query to take effect and show the data in data grid:
SELECT
dbo.WR010130.MANUFACTUREORDER_I, RTSEQNUM_I, RTSEQDES_I, SCHEDULESTARTDATE_I, DONECB_IFROM
dbo.WR010130JOIN WO010032ON dbo.WR010130.MANUFACTUREORDER_I= dbo.WO010032.MANUFACTUREORDER_IJOIN
dbo.WC010931ON dbo.WR010130.WCID_I= dbo.WC010931.WCID_IWHERE
dbo.WR010130.DONECB_I<> 1AND dbo.WO010032.MANUFACTUREORDERST_I= 3OR dbo.WO010032.MANUFACTUREORDERST_I= 7AND dbo.WC010931.WCDESC_I=WorkCentreComboBox.TextORDER
BY dbo.WR010130.SCHEDULESTARTDATE_IWC931.WCID_I is found from the WCDESC_I which user selects from combobox. All the three data tables namely WC931, WO32, WR130 are in my medataset.So how can I do this at run time?

