google

How to apply RowFilter on DataView

| Friday, May 9, 2014
Following code can be used to apply filter on the DataView

 DataSet ds = new DataSet();  
 ds= GetData();  
 DataView dv = ds.Tables[0].DefaultView;  
 dv.RowFilter = "SrNo='" + txtSNo.Text.Trim() + "'";   


LIKE, AND , OR operators can also be used in the RowFilter of Dataview.

To access the filtered records, each DataRowView of the DataView

 foreach (DataRowView drv in dv)  
       {  
         currentName = Convert.ToString(drv["Name"]);  
       }  



0 comments:

Post a Comment

Next Prev
▲Top▲