I'm sure this is a simple issue, but I'm trying to combine 2 columns into a new output column, but have not had any luck with it. Each time I get an 'Object reference not set to an instance of an object.' error
Here is my code:
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)
'
' Add your code here
'
Dim tmpStr As String
tmpStr = ""
If Not IsNumeric(Row.addrmap.ToString) Then
tmpStr = Row.addrmap.ToString.Substring(Row.addrmap.ToString.Length - 2, 1)
tmpStr = Row.addrmap.ToString.Remove(Row.addrmap.ToString.Length - 2, 1).PadLeft(3, CChar("0")) & " " & tmpStr.PadLeft(3, CChar("0")) & " " & Row.addrpar.ToString
Else
tmpStr = Row.addrmap.ToString.PadLeft(3, CChar("0")) & " " & "000 " & Row.addrpar.ToString
End If
Row.addrMapPar = tmpStr
End Sub
End Class
Thanks for the help!
I figured out the issue! It had to do with NULLS in the data. I didn't provide the data, I was just parsing through it and found that there were some NULLs I didn't know about.
To fix it, I used:
If Row.addrmap_IsNull = False and Row.addrpar_IsNull = False Then
...
End If