Vote count:
0
I'm in Visual basic 2008 (SSIS, script task), so this is .Net and I"m using Filesystemobject (Scripting.FileSystemObject).
I can't tell why the .Writeline commands are not writing a new line - they're continuing on the same line.
I've used filesystemobject for years in vbscript and vba, never seen it behave this way.
What am I missing?
Code:
Public Sub Main()
'
' Add your code here
'
Dim fso As Object
Dim fsofolder As Object
Dim fsofile As Object
Dim ts As Object
Dim tsLog As Object
Dim strLog As String
strLog = "\\path\LogFiles\Import\" _
& Now.ToString("MMddyyhhmmss") & ".txt"
Dim lngFiles As Long, lngRecords As Long
fso = CreateObject("Scripting.Filesystemobject")
tsLog = fso.CreateTextFile(strLog, True)
tsLog.writeline(Now() & " | " & "Beginning process")
fsofolder = fso.getfolder("\\path\IN")
For Each fsofile In fsofolder.files
lngFiles = lngFiles + 1
ts = fso.opentextfile(fsofile.path, 1)
ts.readline() 'gets us PAST the header line, which we don't want to count
Do Until ts.atendofstream = True
ts.readline()
lngRecords = lngRecords + 1
Loop
Next
tsLog.writeline(Now() & " | " & "SSIS LOG step finds " & lngFiles & " files, totalling " & lngRecords & " records.")
tsLog.close()
Dts.TaskResult = ScriptResults.Success
End Sub
asked 52 secs ago
Textstream WriteLine is not creating a new LINE with line break. (.Net, FileSystemObject)
Aucun commentaire:
Enregistrer un commentaire