Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Name 'Dts' not declared.

43 views
Skip to first unread message

ryangomez

unread,
Nov 17, 2009, 5:53:24 AM11/17/09
to
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

Todd C

unread,
Nov 17, 2009, 8:48:11 AM11/17/09
to
Ryan:
Are you placing your script task on the Control Flow, or in a Data Flow?

I think it makes a difference which Imports statements the Script adds
automatically. Try one of each and examine the pre-defined parts.

HTH
=====
Todd C


"Ryan Gomez" wrote:

> .
>

0 new messages