I am trying to write a bunch of records returned from a SqlDataReader query to a text file. When I use StreamWriter the output stops at the same place every time. I am using VB.Net 2005.
I can illustrate it using the following code. Rather than returning a file with 2000 rows, it stops at 1550:
Public Sub Main()
Dim x As Integer
Dim sFileName As String
sFileName = "C:\Test.txt"
Dim fs As New FileStream(sFileName, FileMode.Create, FileAccess.Write)
Dim s As New StreamWriter(fs)
For x = 1 To 2000
Dts.TaskResult = Dts.Results.Success
What am I doing wrong?