开发者

writing to file using Script task in SSIS 2005 not working

开发者 https://www.devze.com 2022-12-24 12:15 出处:网络
could anybody give me any clue why this script not doing the job to write the file? in fact when i\'m trying to run it on SSIS 2005, the task showed up green and success

could anybody give me any clue why this script not doing the job to write the file? in fact when i'm trying to run it on SSIS 2005, the task showed up green and success

I'm confused

Imports System
Imports System.Data
Imports System.Math
Imports Microsoft.SqlServer.Dts.Runtime
Imports System.IO

Public Class ScriptMain
Public Sub Main()

System.IO.File.AppendAllText("e:\test.txt","<![CDATA[ <b>Sales</b>]]>")

Dts.TaskResult = Dts.Resul开发者_如何学Gots.Success
End Sub

End Class

Thank you in advance


Looks like there is a problem passing in the XML. Try the following and see if that works, if so, then the XML fragment you are adding is the issue.

Public Sub Main()
    Dim strFile As String
    Dim strText As String

    strFile = "e:\test.txt"
    strText = "test"

    Try
        File.AppendAllText(strFile, strText)
    Catch e As Exception
        Dts.TaskResult = Dts.Results.Failure
    End Try
    Dts.TaskResult = Dts.Results.Success


End Sub
0

精彩评论

暂无评论...
验证码 换一张
取 消