_ | 覦覈襦 | 豕蠏手 | 殊螳 | 譯殊碁
FrontPage › SSIS-IP煙牡覦鰢企襴覲


' Microsoft SQL Server Integration Services Script Component
' Write scripts using Microsoft Visual Basic 2008.
' ScriptMain is the entry point class of the script.

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

<Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute> _
<CLSCompliant(False)> _
Public Class ScriptMain
    Inherits UserComponent

    Public Overrides Sub PreExecute()
        MyBase.PreExecute()
        '
        ' Add your code here for preprocessing or remove if not needed
        '
    End Sub

    Public Overrides Sub PostExecute()
        MyBase.PostExecute()
        '
        ' Add your code here for postprocessing or remove if not needed
        ' You can set read/write variables here, for example:
        ' Me.Variables.MyIntVar = 100
        '
    End Sub

    Public Overrides Sub 0_ProcessInputRow(ByVal Row As 0Buffer)
        '
        ' Add your code here
        '
        Dim binIP(3) As Byte
        Dim valid As Boolean = False

        If String.IsNullOrEmpty(Row.IP) Then
            valid = False
        ElseIf Len(Row.IP) - Len(Row.IP.Replace(".", "")) <> 3 Then
            valid = False
        Else
            valid = Net.IPAddress.TryParse(Row.IP, Nothing)
        End If

        If valid = True Then
            Row.IsValidIp = True

            binIP(0) = CByte(Row.IP.Split(CChar("."))(0))
            binIP(1) = CByte(Row.IP.Split(CChar("."))(1))
            binIP(2) = CByte(Row.IP.Split(CChar("."))(2))
            binIP(3) = CByte(Row.IP.Split(CChar("."))(3))
            Row.IpBinary = binIP
        Else
            Row.IsValidIp = False
        End If
    End Sub

End Class
蠍 蠍郁鍵..
企: : るジ讓曙 襦螻豺 企Ν 譯殊語. 襦螻豺
EditText : Print : Mobile : FindPage : DeletePage : LikePages : Powered by MoniWiki : Last modified 2018-04-13 23:12:53

螳讌襷 . (W. 觚危)