title: Appending to File resulting in missing data
body: <p>I have a script that is connecting to multiple databases and writing a query from each into a text file. However when I run it, I'm not getting the results expected. After some cross checking, it looks like it is writing the same results from the first database query instead of finding new results from the next connection. I inserted an IP string to verify the IPs are being grabbed by the for loop but it seems like I need some way of clearing the reader?</p>
  
  <pre><code>for (int z=0; z&lt;2;z++) {
      using (OleDbConnection connLocal = new OleDbConnection("Provider=SAOLEDB;LINKS=tcpip(host=" + ips[z] + ",PORT=2638);ServerName=EAGLESOFT;Integrated Security = True; User ID = dba; PWD = sql"))
      try
      {
          connLocal.Open();
          using (OleDbCommand cmdLocal = new OleDbCommand("SELECT tran_num, '" + ips[z] + "', provider_id, amount, tran_date, collections_go_to, impacts, type, '" + clinics[z] + "' AS Clinic FROM transactions WHERE tran_date LIKE '2015-11-23%'", connLocal))
         using (StreamWriter sqlWriter = File.AppendText(@"C:\Users\Administrator\Desktop\Clinic.txt"))
          {
  
              using (OleDbDataReader readLocal = cmdLocal.ExecuteReader())
              {
                  while (readLocal.Read())
                  {
                      sqlWriter.WriteLine("{0}|{1}|{2}|{3}|{4}|{5}|{6}|{7}|{8}",
                      readLocal.GetValue(0).ToString(),
                      readLocal.GetValue(1).ToString(),
                      readLocal.GetValue(2).ToString(),
                      readLocal.GetValue(3).ToString(),
                      readLocal.GetValue(4).ToString(),
                      readLocal.GetValue(5).ToString(),
                      readLocal.GetValue(6).ToString(),
                      readLocal.GetValue(7).ToString(),
                      readLocal.GetValue(8).ToString());
                  }
                  readLocal.Close();
              }
              sqlWriter.Close();
              connLocal.Close();
          }
      }
      catch (Exception connerr) { Debug.WriteLine(connerr.Message); }
  }
  </code></pre>
  
  <p>As always, any insight is much appreciated!</p>