Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27554

[RESOLVED] objWriter Text is Truncated

$
0
0
Running the below script is (so far) working as expected, except the text is truncated in the *.txt file. It doesn't return all the data, like the objWriter isn't large enough to hold it all? Not sure if I should be using a different function or need to declare the objWriter in another way? There is no error or exception thrown by .NET.

Code:

While myData.Read()
                    Dim errorCount = 1
                    sb.AppendLine("Error " & errorCount & "-----------------------" & vbCrLf & "Generated Date: " & myData("generated") & vbCrLf & vbCrLf & "Payload value: " & vbCrLf & myData("payload") & vbCrLf & vbCrLf & "Error Response: " & vbCrLf & myData("response") & vbCrLf & vbCrLf & "End Error " & errorCount & "-----------------------" & vbCrLf & vbCrLf)
                    errorCount = errorCount + 1
                End While
If File.Exists("D:\log.txt") Then
                    Dim objWriter As New System.IO.StreamWriter("D:\log.txt", True)
                    objWriter.Write(sb.ToString)
End If

More info: The code not shown connects to an MSSQL database, pulls all the columns from a table that matches a query, and returns it. I know the text is getting truncated because it just ends in the middle rather than ending after a column or something. The data that is pulled from the MSSQL database can / is pretty large. Probably 20+ lines.

Thank you!

Viewing all articles
Browse latest Browse all 27554

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>