In this Programming Post, we will see an example program to get string of comma separated values from DataTable Column in C#.Net.

Generally while working with DataTable, we may need to generate a comma (or any delimiter) separated string and even we may need to generate comma separated values with single quotes to use the string in any sort of Data Filter or to pass it for sql query IN or NOT IN clause etc,. We will achieve this in the following program.

Program :


Output:

comma-seperated-string-datatable-column-output

output text :

*** www.programmingposts.com ***

>>> C# Program to Get Comma Separated String from DataTable Column Values <<<

Printing Comma Seperated String
1,2,3,4,5
Printing Comma Seperated String with single quoted values
‘1’,’2′,’3′,’4′,’5′

Leave a Reply

Your email address will not be published. Required fields are marked *