Solved

DataSet filter

Posted on 2008-10-01
4
291 Views
Last Modified: 2013-12-17
I have dataset populated with all records from student_table  who are Active and Inactive status.
I want to filter this dataset and create another one with all records which are inActive.
how can it be achieved .. thanks in advance
0
Comment
Question by:dotnet0824
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 5

Expert Comment

by:libin_v
ID: 22617823
You can use DataView.RowFilter
private void MakeDataView() 
{
   DataView dv = new DataView();
 
   dv.Table = DataSet1.Tables["Students"];
   dv.AllowDelete = true;
   dv.AllowEdit = true;
   dv.AllowNew = true;
   dv.RowFilter = "Status = 'Active'";
   dv.RowStateFilter = DataViewRowState.ModifiedCurrent;
   
   // Simple bind to a TextBox control
   Text1.DataBindings.Add("Text", dv, "StudentID");
}

Open in new window

0
 
LVL 3

Accepted Solution

by:
trunghieubkit earned 150 total points
ID: 22621367
Do you want to create new DataSet that contains all records with Inactive status from the original DataSet?
0
 
LVL 26

Assisted Solution

by:Anurag Thakur
Anurag Thakur earned 100 total points
ID: 22627007
if your requirement is to simply populate the active students already fetched in the previous table to another gridview then its quite simple

DataView dv = ds.Tables["student_table].DefaultView;
dv.RowFilter = "IsActive = true";

gvActiveStudents.DataSource = dv;
gvActiveStudents..DataBind();
0
 

Author Comment

by:dotnet0824
ID: 22628995
Raqi ur right.. Thats what i want. but can it be  a Dataset... DV is bound again . Can it be bound again to dataset. as I only know how to retrieve rows using Dataset
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question