Quantcast
Channel: SQL Server Integration Services forum
Viewing all articles
Browse latest Browse all 24688

Help with VB in script task

$
0
0

This is how my code exists in the script task.I want to modify it by using variable for the path.I defined a variable filepath with package as scope for path  and a variable filename with package as scope for name. How can I use those variables in the query below?

Sub Main()
        If My.Computer.FileSystem.FileExists("C:\SAMPLE.txt") Or My.Computer.FileSystem.FileExists("C:\SAMPLE.xml") Then Dts.TaskResult = ScriptResults.Failure
        Else
            My.Computer.FileSystem.WriteAllText("C:\SAMPLE.txt", Dts.Variables(0).Value.ToString, False)
            My.Computer.FileSystem.WriteAllText("C:\SAMPLE.xml", Dts.Variables(0).Value.ToString, False) 
Dts.TaskResult = ScriptResults.Success
       ''
 End If
    End Sub

Viewing all articles
Browse latest Browse all 24688

Trending Articles