I'm sure that this is probably something simple but I just can't see it. I'm using a streamwriter to read lines of text from a text file, populate a dataset then export to an xml file using writexml but every time I go through the loop it writes over the text in the file instead of adding on... I tried moving the writexml 2 brackets down but then I get more errors... can anyone see what's wrong?
foreach(string F in fileName)
// to take policydataset and parse out info
//StreamWriter sw = new StreamWriter(fileResultName);
//sw.WriteLine("<?xml version='1.0' encoding='ISO-8859-1'?>\n<memberdata>");
using (StreamReader sr = new StreamReader(F))
// Read and display lines from the file until the end of
// the file is reached.
while ((line = sr.ReadLine()) != null)
polDS.Policy.CLIENT = "CAA";
polDS.Policy.DIVISION = line.Substring(3,3);
polDS.Policy.BRANCH = line.Substring(3,5);
// i took a bunch of stuff out of here to shorten it
string justFileName = Path.GetFileNameWithoutExtension(F);