I'm able to read rows separated by "~" but once I try to read the values separated by comma, my output returns nothing.
Any help is appreciated!

strInput is a .csv file.

 Content= strField[0],strField[1],strField[2],strField[3],srField[4],strField[5]~
          strField[0],strField[1],strField[2],strField[3],srField[4],strField[5]~
          strField[0],strField[1],strField[2],strField[3],srField[4],strField[5]~





using (StreamWriter write = new StreamWriter(filePath, true)){

string[] line = strInput.Split('~');
foreach (string part in line)
 {
   string[] strField = part.Split(',');
   strDetails += "" + "," + "Heading1" + "," + "Heading2 + "," + strField[0] + "," + strField[5] + "," + strField[1] + "," + strField[2] + "," + strField[4] + "~";
   write.WriteLine(strDetails);
    }
}

your quotation marks are incorrect. You have:
strDetails += "" + "," + "Heading1" + "," + "Heading2 + "," + strField[0] + "," + strField[5] + "," + strField[1] + "," + strField[2] + "," + strField[4] + "~";
when it should be:
strDetails += "" + "," + "Heading1" + "," + "Heading2" + "," + strField[0] + "," + strField[5] + "," + strField[1] + "," + strField[2] + "," + strField[4] + "~";

This is why using String.Format is so much nicer, you don't fail to see the missing quotation marks:
strDetails += string.Format(",Heading1,Heading2,{0},{1},{2},{3},{4}~", strField[0], strField[5], strField[1], strField[2], strField[4]);

Hope this helps,
Mark A. Malo

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.