Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

DataSet filter

Posted on 2008-10-01
4
Medium Priority
?
305 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
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 600 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 400 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

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

885 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