dbTalk Databases Forums  

Name 'Dts' not declared.

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Name 'Dts' not declared. in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Ryan Gomez
 
Posts: n/a

Default Name 'Dts' not declared. - 11-17-2009 , 04:53 AM






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.Replac e("<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...ommunicat.aspx

Reply With Quote
  #2  
Old   
Todd C
 
Posts: n/a

Default RE: Name 'Dts' not declared. - 11-17-2009 , 07:48 AM






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:

Quote:
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.Replac e("<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...ommunicat.aspx
.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.