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;


One thought on “How to filter data in dataset

  1. Pingback: 2010 in review « What i know is

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s