VBScript within DTS

  • The following VBScript generates an error during runtime even though it parses no problem in DTS...

    Function Main()

     DTSGlobalVariables("Counter").Value = DTSGlobalVariables("Counter").Value + 1

     DTSGlobalVariables("FileName").Value = DTSGlobalVariables("FileName").Value & CStr( DTSGlobalVariables("Counter").Value ) 

     DTSGlobalVariables("FileName").Value = DTSGlobalVariables("FileName").Value & ".MAIL"

     Main = DTSTaskExecResult_Success

    End Function

    Global var "Counter" = integer

    Global var "FileName" = string

    The error is..."Variable uses an automation type not supported in VBScript."

    "Error on Line 1"

    I used the VBScript Language builder in DTS to create this.

    Any thoughts?

  • Martin,

    Try this - DTSGlobalVariables("Counter").Value = CINT(DTSGlobalVariables("Counter").Value) + 1

     

    Good Luck,

    Darrell

  • That worked.

    Thank you for your help.

  • I get lucky once in a while!!

    Glad to be of assistance.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply