Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Harris00
Starting Member
19 Posts |
Posted - 2009-05-08 : 11:07:41
|
HelloI am using Streamwriter as below but it writes only the last message instead of appending to the file?I am doing this in script task of SSIS.Using writer As StreamWriter = New StreamWriter("C:\STExceptionLog.txt") writer.WriteLine() writer.Write(ex.ToString) writer.Flush() writer.Close() End Usinghow could i add and append log messages to the text file in Script task? |
|
rgombina
Constraint Violating Yak Guru
319 Posts |
Posted - 2009-05-08 : 11:54:20
|
[code] Using writer As StreamWriter = New StreamWriter("C:\STExceptionLog.txt", True) writer.WriteLine("Blah blah") writer.Flush() writer.Close() End Usingor Dim sw As StreamWriter If File.Exists("C:\STExceptionLog.txt") Then sw = New StreamWriter("C:\STExceptionLog.txt", True) 'True for appending sw.WriteLine("Blah blah") sw.Flush() sw.Close() End If[/code] |
 |
|
Harris00
Starting Member
19 Posts |
Posted - 2009-05-08 : 13:08:06
|
Thanks... |
 |
|
|
|
|