Can any one tell why the previous data is still displayed while saving data using StreamWriter

前端 未结 2 427
情深已故
情深已故 2021-01-28 05:43

I am saving data to a file-name using Stream writer but if i run the code for second time the same data is appended to the previous data but i would like to clear the old data a

相关标签:
2条回答
  • 2021-01-28 06:18

    You're passing true as the append parameter in the StringWriter constructor.

    0 讨论(0)
  • 2021-01-28 06:18

    Second parameter here: new StreamWriter(StrFilePath,true) is set to true, which means append to file. Set that parameter to false and it will work.

    0 讨论(0)
提交回复
热议问题