.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Post New Resource Bookmark and Share   

Getting distinct rows from a datatable or dataset

Posted By:Maverick       Posted Date: July 21, 2011    Points: 200    Category:    URL: http://www.dotnetspark.com  

Getting distinct rows from a datatable or dataset
 

Hello All,

 

If you need to get the distinct rows from a datatable or dataset then use the following method.

DataTable dtDistinctRows = new DataTable();
            dtDistinctRows = dsXML.Tables["Batch"].DefaultView.ToTable(truenew string[] { "ColumnName1""ColumnName2"});

The above code will get the distinct rows from data table "batch" for columns "ColumnName1" and "ColumnName2"

Hope it helps.

Njoy.

 


     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend