Sort data using DataView

Posted by Kristina Fiedalan on Stack Overflow See other posts from Stack Overflow or by Kristina Fiedalan
Published on 2011-11-22T01:11:34Z Indexed on 2011/11/22 1:50 UTC
Read the original article Hit count: 421

Filed under:
|
|

I have a DataGridView with column Remarks (Passed, Failed). For example, I want to show all the records Failed in the column Remarks using DataView, how do I do that? Thank you. Here's the code I'm working on:

ds.Tables["Grades"].PrimaryKey = new DataColumn[] { ds.Tables["Grades"].Columns["StudentID"] };
DataRow dRow = ds.Tables["Students"].Rows.Find(txtSearch.Text);

DataView dataView = new DataView(dt);
dataView.RowFilter = "Remarks = " + txtSearch.Text;
dgvReport.DataSource = dataView;

© Stack Overflow or respective owner

Related posts about c#

Related posts about winforms