Sujeet Raman

Sujeet Raman

  • 862
  • 927
  • 351.8k

Convert datatable column values in a comma separated string in c#

Nov 23 2021 3:37 PM

I have a datatable who has two column with values as below

NO  NAME
1     A
2     B
3     C
4     D

So what I want ONLY NAME  values in a string with comma separated and single quoted  like below

string names= 'A','B','C','D'

How will I get input as an sql query

example :  "select names in ('A','B','C','D')";

 how to add single quotes? i may have 100 data

 


Answers (5)