视觉基本功能

时间:2017-10-26 09:25:54

标签: vb.net visual-studio-2015 ssis

我们正在进行SQL Server 2008 R2到2016升级。我们正在升级SSIS包。在这些包中,我们有一个脚本组件,可以将计数保存在变量中:#Records:SourceinSource

在visual basic 2008版本中,我们使用这段代码将计数转换为NVARCHAR值。

Dim MyRecordsInSource As String

Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)
    MyRecordsInSource = Row.CASTCOUNT1ASNVARCHAR28
    End Sub

Public Overrides Sub PostExecute()
    MyBase.PostExecute()
    Me.Variables.varRecordsInSource = MyRecordsInSource
    End Sub

但是在我们在2015版本中执行包之后,代码被转换为以下内容并给出转换错误。请注意,CASTCOUNT1ASNVARCHAR28已由visual studio或vb更改为ToString

Dim MyRecordsInSource As String

Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)
    MyRecordsInSource = Row.ToString()
    End Sub

Public Overrides Sub PostExecute()
    MyBase.PostExecute()
    Me.Variables.varRecordsInSource = MyRecordsInSource
    End Sub

有没有人认识到这个问题,或者有没有办法在不使用ToString函数的情况下转换变量

我的日志记录中出现以下错误。当我用旧代码CASTCOUNT1ASNVARCHAR28替换toString时,所有框都检查为绿色。使用Tostring(),我在执行SQL任务中遇到了错误:

[Execute SQL Task] Error: Executing the query "insert into etl.process_stagingin_log (BatchNr 
, ..." failed with the following error: "Conversion failed when converting the varchar value 'SC_64e4ca4597264faf93443f856b4b31a2.Input0Buffer' to data type int.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.

SC_64e4ca4597264faf93443f856b4b31a2是vb脚本的名称。而inpt0Buffer是转换函数

的部分

0 个答案:

没有答案
相关问题