Solved

DataSet filter

Posted on 2008-10-01
4
295 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

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

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

A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
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…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

627 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