Using VB.NET, what is the most concise way to convert a single column of a DataTable to a CSV? The values are integers, so I don’t need to worry about character escaping or encoding.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
What do you mean with “convert to CSV”? If you want to generate a string with comma-separated values, you can use this(
tblis your DataTable andInt-Columnis the name of the DataColumn):A CSV normally is a file-format where the columns are separated by comma(or other separators) and the rows are separated by new lines. Hence you simply have to replace
String.Join(","withString.Join(Environment.NewLine