日期:2014-05-19  浏览次数:20585 次

用过SQL2005 SSIS-脚本组件的朋友们 进来接分!
SQL2005   SSIS-在脚本组件中访问数据连接  
OLE   DB   连接     和   ADO.NET   连接
那个速度快?

那位高手有脚本组件中访问数据并进行查询操作的代码例子     发给我学习一下  
万分感谢!!!

------解决方案--------------------
不知道哦,頂..
------解决方案--------------------
关注一下!


------解决方案--------------------
這個沒試過。
------解决方案--------------------
进来看看,有分不?
------解决方案--------------------
' Microsoft SQL Server Integration Services Script Task
' Write scripts using Microsoft Visual Basic
' The ScriptMain class is the entry point of the Script Task.

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

Public Class ScriptMain

' The execution engine calls this method when the task executes.
' To access the object model, use the Dts object. Connections, variables, events,
' and logging features are available as static members of the Dts class.
' Before returning from this method, set the value of Dts.TaskResult to indicate success or failure.
'
' To open Code and Text Editor Help, press F1.
' To open Object Browser, press Ctrl+Alt+J.

Public Sub Main()
'
' Add your code here
'
Dim sqlConn As SqlClient.SqlConnection
sqlConn = CType(Dts.Connections( "LocalHost.HNA_ODS1 ").AcquireConnection(Nothing), SqlClient.SqlConnection)

Dim command As New SqlClient.SqlCommand
command.Connection = sqlConn
command.CommandType = CommandType.Text
command.CommandText = "SELECT MAX_INC_SIGN FROM inc_sign WHERE TABLE_NAME = 'ODS_FOC_LEGS ' "
Dim SR As SqlClient.SqlDataReader = command.ExecuteReader()
If SR.Read() Then
Dts.Variables( "ODS_FOC_LEGS_SQL ").Value = "select a.*,sysdate as input_date,sysdate as modify_date from fleetwatch.legs a where to_char(to_date(std, 'yyyy-MM-dd HH24:mi:ss ') - 8/24, 'yyyy-mm-dd ') < to_char(sysdate, 'yyyy-mm-dd ') and to_char(to_date(std, 'yyyy-MM-dd HH24:mi:ss ') - 8/24, 'yyyy-mm-dd ') > = ' " + SR.GetString(0) + " ' "

'Windows.Forms.MessageBox.Show(CStr(Dts.Variables( "ODS_FOC_LEGS_SQL ").Value))
End If

command = Nothing
Dts.TaskResult = Dts.Results.Success
End Sub

End Class
------解决方案--------------------
给你的邮箱地址,给你一个.我的邮箱是scckobe@hotmail.com,要不给我发邮件吧