日期:2014-05-17 浏览次数:20891 次
if (!File.Exists("SwitchFailure.txt")) { FileStream fs1 = new FileStream("SwitchFailure.txt", FileMode.Create, FileAccess.Write);//创建写入文件 StreamWriter sw = new StreamWriter(fs1); sw.WriteLine("DocNo:" + dt.Rows[i][1].ToString().Trim() + "\r\nDocRev:" + dt.Rows[i][2].ToString().Trim()+"\r\n---------------------\r\n");//开始写入值 sw.Close(); fs1.Close(); } else { FileStream fs = new FileStream("SwitchFailure.txt", FileMode.Open, FileAccess.Write); StreamWriter sr = new StreamWriter(fs); sr.WriteLine("\r\nDocNo:" + dt.Rows[i][1].ToString().Trim() + "\r\nDocRev:" + dt.Rows[i][2].ToString().Trim() + "\r\n---------------------"); sr.Close(); fs.Close(); }