dbTalk Databases Forums  

Global Variables and Script Task

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


Discuss Global Variables and Script Task in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Jeanine Carroll
 
Posts: n/a

Default Global Variables and Script Task - 07-25-2006 , 10:47 AM






I am trying to set the value of the variable User::ErrorMessage dynamically
using the Script Task. I would like to construct an error message containing
carriage returns for use with a Send Mail Task.

ReadOnlyVariables :
User:WAuditStepDescription,System::StartTime,Sys tem::EventHandlerStartTime,System::PackageName

ReadWriteVariables :
User::ErrorMessage

Script Code:

Public Sub Main()

Dts.Variables("User::ErrorMessage").Value = "Package: " &
Convert.ToString(Dts.Variables("System::PackageNam e")) & Chr(13) & "Internal
Step Name"
'
Dts.TaskResult = Dts.Results.Success
End Sub

After executing the Script Task, the value of User::ErrorMessage is

"Package: Microsoft.SqlServer.Dts.Runtime.Variable\rInternal Step Name"

What am I doing wrong?

Thanks!

Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: Global Variables and Script Task - 07-25-2006 , 01:20 PM






The following example works for me

Public Sub Main()

'

Dts.Variables.Item("sV").Value = "Hello" & Chr(13) & Chr(10) & "World"

MsgBox(Dts.Variables.Item("sV").Value)

'

Dts.TaskResult = Dts.Results.Success

End Sub



Allan




"Jeanine Carroll" <JeanineCarroll (AT) discussions (DOT) microsoft.com> wrote in
message news:A7BC8D9D-5FA1-4128-BF07-752541DB3AA5 (AT) microsoft (DOT) com...
Quote:
I am trying to set the value of the variable User::ErrorMessage dynamically
using the Script Task. I would like to construct an error message
containing
carriage returns for use with a Send Mail Task.

ReadOnlyVariables :
User:WAuditStepDescription,System::StartTime,Sys tem::EventHandlerStartTime,System::PackageName

ReadWriteVariables :
User::ErrorMessage

Script Code:

Public Sub Main()

Dts.Variables("User::ErrorMessage").Value = "Package: " &
Convert.ToString(Dts.Variables("System::PackageNam e")) & Chr(13) &
"Internal
Step Name"
'
Dts.TaskResult = Dts.Results.Success
End Sub

After executing the Script Task, the value of User::ErrorMessage is

"Package: Microsoft.SqlServer.Dts.Runtime.Variable\rInternal Step Name"

What am I doing wrong?

Thanks!



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.