.NET程序调用SSIS中的DTS包
发布时间:2020-12-17 01:24:57 所属栏目:安全 来源:网络整理
导读:以下代码是在VB.NET(Framework 2.0)中调用SQLServer2005 的Intergration Service中DTS包。 1 如果要在WebService中调用DTS,必须用VB.NET语言。因为如果用C#编写WebService的话,将无法引用 Microsoft.SqlServer.ManagedDTS 组件。 2 将NETWORK SERVICE帐户
以下代码是在VB.NET(Framework 2.0)中调用SQLServer2005 的Intergration Service中DTS包。
?1?
Imports
?Microsoft.SqlServer.Dts.Runtime
?2? ?3? ' WebService代码 ?4? ???? < WebMethod() > ?_ ?5? ???? Public ? Function ?ExecutePackage()? As ? Integer ?6? ???????? Dim ?pkg? As ? String ? = ? " D:/Development/Programe/PackageDev/Package/MG-TSJF-PKG.dtsx " ?7? ?8? ???????? Dim ?app? As ?Application? = ? New ?Application() ?9? ???????? Dim ?p? As ?Package? = ?app.LoadPackage(pkg,? Nothing ) 10? ???????? ' p.InteractiveMode?=?True 11? 12? ???????? Dim ?vir? As ?Variables? = ?p.Variables 13? ????????vir( " 用户::PackageID " ).Value? = ? 4 14? 15? ???????? If ?p.Execute( Nothing ,?vir,? Nothing ,? Nothing )? = ?DTSExecResult.Success? Then 16? ???????????? Return ? 0 17? ???????? Else 18? ???????????? Return ? 1 19? ???????? End ? If 20? ???? End?Function (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |