Sairam Soham

Sairam Soham

  • NA
  • 47
  • 28.8k

Filter a table of dataset added by using data source option

Jun 10 2015 3:46 PM

I have added dataset IADataSet to the project using View > Other Windows > Data Sources option

This dataset has 2 tables out of which 1 is NG_RevClassAvgByDate

I am able to fill the data into the table object from database with the following lines of code

IADataSet.NG_RevClassAvgByDateDataTable table = new IADataSet.NG_RevClassAvgByDateDataTable();
 
IADataSetTableAdapters.NG_RevClassAvgByDateTableAdapter ada = new IADataSetTableAdapters.NG_RevClassAvgByDateTableAdapter();
 
ada.Fill(table);

 

I have two variables year and month

and third  variable revenueclass

In the database in the table I have Year_Month column which corresponds to year + '-' + month

In the database corresponding to revenueclass variable I have a column RevenueClassID.

 

Question:

Instead of populating all the data in the table object from a database table will it be possible to populate only data for the following filter clause

Year_Month column =  year + '-' + month  AND RevenueClassID = revenueclass

Any thoughts?


Answers (1)