Access to a variable in a script task (traformation) in data flow

  • Hi,

    I put the 2 variables name into onlyread row of access proprety of script task, but when I'm on the code, Visual Studio give me an error like don't recognize the name space of DTS.

    I wrong sopmething?

    Imports System

    Imports System.Data

    Imports System.Math

    Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper

    Imports Microsoft.SqlServer.Dts.Runtime.Wrapper

    Public Class ScriptMain

    Inherits UserComponent

    Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)

    Dim strArrTemp As String = "," & Dts.Variables("arrIDsourceDispoToZero").value & ","

    Dim strIDrisorsa As String = "," & Dts.Variables("IDrisorsa").value & ","

    'Se è un listino la cui disponibilità è da bloccare

    If InStr(strArrTemp, strIDrisorsa) > 0 Then

    Row.Copiadidispo = "0"

    End If

    End Sub

    End Class

  • Alen,

    Hard to say with out seeing the error, but try this.

    I've not used the VB.Net & concatenation, since the String.Format became avaliable. Your error may be due to a type conversion problem.

    Change this

    Dim strArrTemp As String = "," & Dts.Variables("arrIDsourceDispoToZero").value & ","

    Dim strIDrisorsa As String = "," & Dts.Variables("IDrisorsa").value & ","

    to this

    Dim strArrTemp As String = String.Format(",{0},", Dts.Variables("arrIDsourceDispoToZero").Value)

    Dim strIDrisorsa As String = String.Format(",{0},", Dts.Variables("IDrisorsa").Value)

    String.Format eliminates the need to use CType or the ToString method. Plus it is supposed to perform better than concatenation with &.

    Hope this helps,

    Norman

    DTS Package Search

    http://www.dtspackagesearch.com/

  • Thanks...I never use this kind of syntax...

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

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