dbTalk Databases Forums  

writing to sequence container scoped variable from script component

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


Discuss writing to sequence container scoped variable from script component in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
kent.eilers@res-direct.com
 
Posts: n/a

Default writing to sequence container scoped variable from script component - 06-01-2008 , 09:49 AM






hi - i'm trying to populate a sequence level variable from a script
inside a data flow. I am able to
1) reference the 'variableDispenser' object...
2) create a pointer to the variables collection with the statement..
3) lock my variable...
4) but don't know the syntax to write to it.....

I've googled and gotten a few examples - all of which are flagged as
invalid syntax.
Can someone review and provide the correct syntax...or explain why the
code I've grabbed from google
(and microsoft help online) is being flagged as invalid in my script?

Thanks very much!
================================================== ========================

Imports System
Imports System.Data
Imports System.Math
Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper
Imports Microsoft.SqlServer.Dts.Runtime.Wrapper
Imports Microsoft.SqlServer.Dts.Runtime
Imports Microsoft.SqlServer.Dts

Public Class ScriptMain
Inherits UserComponent

Public Overrides Sub Input0_ProcessInputRow(ByVal Row As
Input0Buffer)
'only one row is processed......
Dim year_ As Integer
Dim month_ As Integer
Dim date_ As Date

Dim vars As Variables
Dim varsdisp As VariableDispenser

date_ = CType(Row.f1, DateTime)
year_ = Year(date_)
month_ = Month(date_)

VariableDispenser.LockForWrite("User:iMonth")

'the following lines get flagged as incorrect...

Variables("User:iMonth").value = 1
Variables("iMonth").value = 1
'or....
vars("User:iMonth").value = 1
vars("iMonth").value = 1


End Sub

End Class

Reply With Quote
  #2  
Old   
jhofmeyr@googlemail.com
 
Posts: n/a

Default Re: writing to sequence container scoped variable from scriptcomponent - 06-02-2008 , 07:17 AM






Hi Kent,

Try:
Dim var As IDTSVariables90

Me.VariableDispenser.LockOneForWrite("iMonth", var)

var("iMonth").Value = 1

var.Unlock()

Good luck!
J

Reply With Quote
  #3  
Old   
jhofmeyr@googlemail.com
 
Posts: n/a

Default Re: writing to sequence container scoped variable from scriptcomponent - 06-02-2008 , 07:17 AM



Hi Kent,

Try:
Dim var As IDTSVariables90

Me.VariableDispenser.LockOneForWrite("iMonth", var)

var("iMonth").Value = 1

var.Unlock()

Good luck!
J

Reply With Quote
  #4  
Old   
jhofmeyr@googlemail.com
 
Posts: n/a

Default Re: writing to sequence container scoped variable from scriptcomponent - 06-02-2008 , 07:17 AM



Hi Kent,

Try:
Dim var As IDTSVariables90

Me.VariableDispenser.LockOneForWrite("iMonth", var)

var("iMonth").Value = 1

var.Unlock()

Good luck!
J

Reply With Quote
  #5  
Old   
jhofmeyr@googlemail.com
 
Posts: n/a

Default Re: writing to sequence container scoped variable from scriptcomponent - 06-02-2008 , 07:17 AM



Hi Kent,

Try:
Dim var As IDTSVariables90

Me.VariableDispenser.LockOneForWrite("iMonth", var)

var("iMonth").Value = 1

var.Unlock()

Good luck!
J

Reply With Quote
  #6  
Old   
jhofmeyr@googlemail.com
 
Posts: n/a

Default Re: writing to sequence container scoped variable from scriptcomponent - 06-02-2008 , 07:17 AM



Hi Kent,

Try:
Dim var As IDTSVariables90

Me.VariableDispenser.LockOneForWrite("iMonth", var)

var("iMonth").Value = 1

var.Unlock()

Good luck!
J

Reply With Quote
  #7  
Old   
jhofmeyr@googlemail.com
 
Posts: n/a

Default Re: writing to sequence container scoped variable from scriptcomponent - 06-02-2008 , 07:17 AM



Hi Kent,

Try:
Dim var As IDTSVariables90

Me.VariableDispenser.LockOneForWrite("iMonth", var)

var("iMonth").Value = 1

var.Unlock()

Good luck!
J

Reply With Quote
  #8  
Old   
jhofmeyr@googlemail.com
 
Posts: n/a

Default Re: writing to sequence container scoped variable from scriptcomponent - 06-02-2008 , 07:17 AM



Hi Kent,

Try:
Dim var As IDTSVariables90

Me.VariableDispenser.LockOneForWrite("iMonth", var)

var("iMonth").Value = 1

var.Unlock()

Good luck!
J

Reply With Quote
  #9  
Old   
jhofmeyr@googlemail.com
 
Posts: n/a

Default Re: writing to sequence container scoped variable from scriptcomponent - 06-02-2008 , 07:17 AM



Hi Kent,

Try:
Dim var As IDTSVariables90

Me.VariableDispenser.LockOneForWrite("iMonth", var)

var("iMonth").Value = 1

var.Unlock()

Good luck!
J

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

Default Re: writing to sequence container scoped variable from script comp - 06-11-2008 , 03:03 PM



Kent

If that didn't work, try referring to it with Dts. in front:

Dts.Variables("myVariable").Value
--
Todd C



"jhofmeyr (AT) googlemail (DOT) com" wrote:

Quote:
Hi Kent,

Try:
Dim var As IDTSVariables90

Me.VariableDispenser.LockOneForWrite("iMonth", var)

var("iMonth").Value = 1

var.Unlock()

Good luck!
J


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.