dbTalk Databases Forums  

Regarding SSIS

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


Discuss Regarding SSIS in the microsoft.public.sqlserver.dts forum.



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

Default Regarding SSIS - 05-03-2006 , 09:01 AM






Dear all,

I am writing a SSIS package which own an ActiveX Script Task (Visual Basic
Script code incide) but I haven’t idea or any clue about how do I set up
global variables.
Something like that:

Dim strIdioma
strIdioma = DTSGlobalVariables("strIdioma").Value


property “Script” allows me paste any snippet of code but then I don’t know
how to link my variables before created.

On the other hand "Script task" allows only to introduce Visual Basic .Net
and then design by Visual Studio.

Any comment would be very appreciated.



Reply With Quote
  #2  
Old   
Panos Stavroulis.
 
Posts: n/a

Default RE: Regarding SSIS - 05-17-2006 , 04:05 AM






I don't know how to read a global variable within an activex script. However,
I had no problems using global variables within vb.net.

I'll suggest you start using .net for ssis. To call a variable use something
like this

If Dts.Variables.Contains("my_variable") = True Then
Dts.VariableDispenser.LockOneForRead("my_variable" , variables)
End If

sDest = CStr(variables("my_variable").Value)

However you need to pass my_variable as the read variable in the parameters
screen on the Script Task. Otherwise it doesn't seem to work.

Panos.

"Enric" wrote:

Quote:
Dear all,

I am writing a SSIS package which own an ActiveX Script Task (Visual Basic
Script code incide) but I haven’t idea or any clue about how do I set up
global variables.
Something like that:

Dim strIdioma
strIdioma = DTSGlobalVariables("strIdioma").Value


property “Script” allows me paste any snippet of code but then I don’t know
how to link my variables before created.

On the other hand "Script task" allows only to introduce Visual Basic .Net
and then design by Visual Studio.

Any comment would be very appreciated.



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

Default RE: Regarding SSIS - 05-17-2006 , 06:33 PM



Hello Panos Stavroulis.,

It doesn't work because you can only work with locked variables. You do not
have to lock them on the outside of the Script task either. Doing it there
means the variable is locked for the duration of the task and this could
cause issues. If you want to be more proactive in the locking and releasing
have a look at the

LockOneForRead
LockOneForWrite
VariableDispenser

topics in BOL


Allan Mitchell
www.SQLDTS.com
www.SQLIS.com
www.Konesans.com

Quote:
I don't know how to read a global variable within an activex script.
However, I had no problems using global variables within vb.net.

I'll suggest you start using .net for ssis. To call a variable use
something like this

If Dts.Variables.Contains("my_variable") = True Then
Dts.VariableDispenser.LockOneForRead("my_variable" ,
variables)
End If
sDest = CStr(variables("my_variable").Value)

However you need to pass my_variable as the read variable in the
parameters screen on the Script Task. Otherwise it doesn't seem to
work.

Panos.

"Enric" wrote:

Dear all,

I am writing a SSIS package which own an ActiveX Script Task (Visual
Basic
Script code incide) but I haven't idea or any clue about how do I set
up
global variables.
Something like that:
Dim strIdioma
strIdioma = DTSGlobalVariables("strIdioma").Value
.
property "Script" allows me paste any snippet of code but then I
don't know how to link my variables before created.

On the other hand "Script task" allows only to introduce Visual Basic
.Net and then design by Visual Studio.

Any comment would be very appreciated.




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.