Contents



OLEDB 覲
  1. Imports System
  2. Imports System.Data
  3. Imports System.Math
  4. Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper
  5. Imports Microsoft.SqlServer.Dts.Runtime.Wrapper
  6. Imports System.Data.OleDb
  7.  
  8. Public Class ScriptMain
  9. Inherits UserComponent
  10.  
  11. Dim DBReader As OleDbDataReader
  12. Dim DBConn As OleDbConnection
  13. Dim DBCommand As OleDbCommand
  14.  
  15. Public Overrides Sub AcquireConnections(ByVal Transaction As Object)
  16.  
  17. Dim ConnString As String = Me.Connections.郁屋.ConnectionString
  18. DBConn = New OleDbConnection(ConnString)
  19. DBConn.Open()
  20.  
  21. End Sub
  22.  
  23. Public Overrides Sub PreExecute()
  24.  
  25. DBCommand = New OleDbCommand("select * frmo TableA", DBConn)
  26. DBReader = DBCommand.ExecuteReader()
  27.  
  28. End Sub
  29.  
  30. Public Overrides Sub PostExecute()
  31.  
  32. DBReader.Close()
  33.  
  34. End Sub
  35.  
  36. Public Overrides Sub CreateNewOutputRows()
  37. '
  38. ' Add rows by calling AddRow method on member variable called "<Output Name>Buffer"
  39. ' E.g., MyOutputBuffer.AddRow() if your output was named "My Output"
  40. '
  41. Dim sLog() As String
  42. Dim sItem() As String
  43. Dim sTemp As String
  44. Dim i As Integer
  45.  
  46. Do While DBReader.Read
  47.  
  48. With 豢0Buffer
  49. .AddRow()
  50. .AccountID = DBReader.GetString(0)
  51. .RegDT = DBReader.GetDateTime(1)
  52. .sArray = DBReader.GetString(2)
  53. End With
  54.  
  55. sLog = DBReader.GetString(2).Split(CChar(","))
  56.  
  57.  
  58. For i = 0 To sLog.Length - 1
  59. sItem = sTemp.Split(CChar("."))
  60. With 危Buffer
  61. .AddRow()
  62. .AccountID = DBReader.GetString(0)
  63. .Item1 = sItem(0)
  64. .Item2 = sItem(1)
  65. .Item3 = sItem(2)
  66. .Item4 = sItem(3)
  67. .ITem5 = sItem(4)
  68. End With
  69. Next
  70. Loop
  71.  
  72. End Sub
  73.  
  74. Public Sub New()
  75.  
  76. End Sub
  77.  
  78. End Class
  79.  
* IE拭辞 社什 差紫獣 匝郊嘩 照喫. MS-Word 去拭 細食 隔生室推. 匝郊嘩 鞠澗 崎虞酔煽: Chrome, Opera, Safari