unknown
2009-11-17 10:53:24 UTC
Hi all,
I'm a SSIS newbie and I'm attempting to set up a simple Script task.In the Edit Script Task, I have the VB code shown below.
However, I keep getting this error that states "Name 'Dts' not declared". Any pointers on how I can resolve this would be greatly appreciated. Thanks.
Public Sub Main()
'
' Add your code here
'
Dim XMLString As String = " "
XMLString = Dts.Variables("XMLVariable").Value.ToString.Replace("<ROOT>", "").Replace("</ROOT>", "")
XMLString = "<?xml version=""1.0"" ?>" + XMLString
GenerateXmlFile("C:\\MusicCollection.xml", XMLString)
End Sub
Public Sub GenerateXmlFile(ByVal filePath As String, ByVal fileContents As String)
Dim objStreamWriter As IO.StreamWriter
Try
objStreamWriter = New IO.StreamWriter(filePath)
objStreamWriter.Write(fileContents)
objStreamWriter.Close()
Catch Excep As Exception
MsgBox(Excep.Message)
End Try
Dts.TaskResult = Dts.Results.Success
End Sub
EggHeadCafe - Software Developer Portal of Choice
MDI Inter-Form Communication with Events
http://www.eggheadcafe.com/tutorials/aspnet/0a957f0d-585a-4a3c-935f-20ce4f44f644/mdi-interform-communicat.aspx
I'm a SSIS newbie and I'm attempting to set up a simple Script task.In the Edit Script Task, I have the VB code shown below.
However, I keep getting this error that states "Name 'Dts' not declared". Any pointers on how I can resolve this would be greatly appreciated. Thanks.
Public Sub Main()
'
' Add your code here
'
Dim XMLString As String = " "
XMLString = Dts.Variables("XMLVariable").Value.ToString.Replace("<ROOT>", "").Replace("</ROOT>", "")
XMLString = "<?xml version=""1.0"" ?>" + XMLString
GenerateXmlFile("C:\\MusicCollection.xml", XMLString)
End Sub
Public Sub GenerateXmlFile(ByVal filePath As String, ByVal fileContents As String)
Dim objStreamWriter As IO.StreamWriter
Try
objStreamWriter = New IO.StreamWriter(filePath)
objStreamWriter.Write(fileContents)
objStreamWriter.Close()
Catch Excep As Exception
MsgBox(Excep.Message)
End Try
Dts.TaskResult = Dts.Results.Success
End Sub
EggHeadCafe - Software Developer Portal of Choice
MDI Inter-Form Communication with Events
http://www.eggheadcafe.com/tutorials/aspnet/0a957f0d-585a-4a3c-935f-20ce4f44f644/mdi-interform-communicat.aspx