Group Common Row cells as comma separated in DataTable using C# .Net

Last Reply on Sep 14, 2014 09:05 AM By Mudassar

Posted on Sep 14, 2014 09:04 AM

Hi,

I refereed you article on exporting the values from grid view to excel from the below URL

http://www.aspsnippets.com/Articles/Export-GridView-Data-to-Excel-using-OpenXml-in-ASPNet.aspx

My doubt is If the Country is the same and the names are different in the column then how to export it in the excel like
the 2nd table in excel with the names combined.

 NameCountry
  John Hammond United States
  Mudassar Khan India
  Suzanne Mathews India

 

 NameCountry
  John Hammond United States
  Mudassar Khan,Suzanne Mathews India
     

Pls help in this sir...

Posted on Sep 14, 2014 09:05 AM

You need to first get the result using SQL Query into datatable and then export. Refr the following

  1. Group and get Comma Separated values in one column in SQL Server Query