Contents

1 (ろ襴渚瑚規煙 - 覲)
2
3 HexString To Binary


1 (ろ襴渚瑚規煙 - 覲) #

  1. ' Microsoft SQL Server Integration Services user script component
  2. ' This is your new script component in Microsoft Visual Basic .NET
  3. ' ScriptMain is the entrypoint class for script components
  4.  
  5. Imports System
  6. Imports System.Data
  7. Imports System.Math
  8. Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper
  9. Imports Microsoft.SqlServer.Dts.Runtime.Wrapper
  10.  
  11. Public Class ScriptMain
  12.     Inherits UserComponent
  13.  
  14.     Dim CumulatedCnt As Integer
  15.  
  16.     Public Sub New()
  17.         CumulatedCnt = 0
  18.     End Sub
  19.  
  20.     Public Overrides Sub 0_ProcessInputRow(ByVal Row As 0Buffer)
  21.         '
  22.         ' Add your code here
  23.         '
  24.         CumulatedCnt = CumulatedCnt + Row.NewAccountCnt
  25.         Row.TotalAccountCnt = CumulatedCnt
  26.     End Sub
  27.  
  28. End Class
  29.  
* IE拭辞 社什 差紫獣 匝郊嘩 照喫. MS-Word 去拭 細食 隔生室推. 匝郊嘩 鞠澗 崎虞酔煽: Chrome, Opera, Safari

2 #

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 CreateNewOutputRows()



With 豢0Buffer

.AddRow() : .COL1 = 1 : .COL2 = "'AAA'"

.AddRow() : .COL1 = 2 : .COL2 = "'BBB'"

.AddRow() : .COL1 = 3 : .COL2 = "'CCC'"

.AddRow() : .COL1 = 2 : .COL2 = "'ZZZ'"

.AddRow() : .COL1 = 2 : .COL2 = "'111'"

.AddRow() : .COL1 = 2 : .COL2 = "'ZZZ'"

End With



End Sub





End Class


3 HexString To Binary #

'Mac Address
Dim Mac(5) As Byte
Dim i As Integer


For i = 0 To Row.MacAddress.Length - 1 Step 2
    Mac(CType(i / 2, Int32)) = Convert.ToByte(Row.MacAddress.Substring(i, 2), 16)
Next
Row.MacAddrBin = Mac

/// <summary>  
/// Convert string to byte_array  
/// </summary>  
/// <param name="strInput">  
private byte[] String_To_Bytes(string strInput)  
{  
    // i variable used to hold position in string  
    int i = 0;  
    // x variable used to hold byte array element position  
    int x = 0;  
    // allocate byte array based on half of string length  
    byte[] bytes = new byte[(strInput.Length) / 2];  
    // loop through the string - 2 bytes at a time converting  
    //  it to decimal equivalent and store in byte array  
    while (strInput.Length > i + 1)  
    {  
        long lngDecimal = Convert.ToInt32(strInput.Substring(i, 2), 16);  
        bytes[x] = Convert.ToByte(lngDecimal);  
        i = i + 2;  
        ++x;  
    }  
    // return the finished byte array of decimal values  
    return bytes;  
}  
  
/// <summary>  
/// Convert byte_array to string  
/// </summary>  
/// <param name="bytes_Input">  
private string Bytes_To_String(byte[] bytes_Input)  
{  
    // convert the byte array back to a true string  
    string strTemp = "";  
    for (int x = 0; x <= bytes_Input.GetUpperBound(0); x++)  
    {  
        int number = int.Parse(bytes_Input[x].ToString());  
        strTemp += number.ToString("X").PadLeft(2, '0');  
    }  
    // return the finished string of hex values  
    return strTemp;  
}