May 25, 2005 at 9:00 am
May 26, 2005 at 6:23 am
I couldn't believe what you were saying until I tried it. My only guess is that the collection cannot handle a variant (all variables in VBScript are variant, not string or int).
This script worked for me:
'**********************************************************************
' Visual Basic ActiveX Script
'************************************************************************
Function Main()
var = "test"
var1 = "Dog"
found = false
for each glob in DTSGlobalVariables
if var = glob.Name then
glob.Value = var1
found = true
exit for
end if
next
if found = false then
DTSGlobalVariables.AddGlobalVariable var, var1
end if
msgbox (DTSGlobalVariables("test").Value)
Main = DTSTaskExecResult_Success
End Function
Russel Loski, MCSE Business Intelligence, Data Platform
May 26, 2005 at 6:36 am
Have you checked out Dynamic Properties task. Using the dynamic properties task you can set the global variable straight from the INI file without needed your VB code. Check out the link on sqlDTS.com below that shows an example to create (via code) a dynamice properties task from the INI file.
http://www.sqldts.com/default.aspx?252
To set the property directly you can create the dynamic property task and then choose the INI file as the source for your global variable.
Also have you tried explicit conversion such as:
glob.value=cstr(variable)
good luck.
Brian
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply