In some scenario select distinct data from the Dataset. Dataset provide an option to get distinct data from the dataset. I have database connection to connect my local database.
SqlDataAdapter da = new SqlDataAdapter(“select empolyeename,Department,salary from employees inner
join department on employees.deptid=department.deptid”, con);
DataSet ds = new DataSet();
After fill the dataset we want to select distinct department from the dataset.For this use the DefaultView.ToTable()
GridView1.DataSource= dv.ToTable(true, “Department”);