将字符串CSV转换为字符CSV C#

时间:2016-05-03 02:31:03

标签: c# string csv char

我有CSV "1,2",其值为Char

我需要将其转换为CSV "'1','2'"才能传递给存储过程。看起来像。 String.Join(",", equipmentName.ToArray<char>())

我尝试了类似下面的内容。但它不起作用。

set @running_total := 0;
select date(event_date), (@running_total := @running_total + count(distinct de.iddocument)) AS cumulative_sum , count(distinct de.iddocument)
from document_event as de
left join document as d on d.iddocument = de.iddocument
where d.iddatastream = 142
and de.event_type = 'RESEARCHED'
and de.update_by_id is not null
group by date(event_date);

1 个答案:

答案 0 :(得分:2)

试试这个。

var result = string.Join(",", "1,2".Split(',').Select(x => string.Format("'{0}'", x)));

<强>输出

 '1','2'