How to filter data in dataset


Dataset is collection of data of Tables stored in Client Memory. In some scenario we want to filter the data without submitting another request to the database server.Dataset provide an option to filter the data based on condition. 

SqlDataAdapter da = new SqlDataAdapter(“select
empolyeename,Department,salary from employees inner join department on  employees.deptid= department.deptid”
, con);

DataSet ds = new

da.Fill (ds,“details”);


In the dataset if there is a requirement to filter the data for particular department .For example we assume dept as “Software”.
In this case we can use Data view

DataView dv = new DataView();


dv.RowFilter=“Department =’Software‘”;

GridView1.DataSource = dv;