Torna al Thread

Imports Microsoft.SqlServer.Dts.Runtime Partial Class Prova_Griglia Inherits System.Web.UI.Page Protected Sub form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles form1.Load Dim pkgLocation As String Dim pkg As New Package Dim app As New Application Dim pkgResults As DTSExecResult Dim eventListener As New EventListener() Try pkgLocation = "D:\LAVORI\PROGETTI_INTEGRATION_SERCICES\Globalrisk_Importa\Package.dtsx" pkg = app.LoadPackage(pkgLocation, eventListener) pkg.Variables("SYS_USER").Value = "prova" pkg.Connections(0).ConnectionString = "Data Source=STEFANO;User ID=xxx;Password=xxx;Initial Catalog=DB1;Provider=SQLNCLI.1;Auto Translate=False;" pkg.Connections(1).ConnectionString = "Data Source=STEFANO;User ID=xxx;Password=xxx;Initial Catalog=DB2;Provider=SQLNCLI.1;Auto Translate=False;" pkgResults = pkg.Execute(Nothing, Nothing, eventListener, Nothing, Nothing) 'Console.WriteLine(pkgResults.ToString()) 'Console.ReadKey() Response.Write("ok") Catch ex As Exception End Try End Sub End Class Class EventListener Inherits DefaultEvents Public Overrides Function OnError(ByVal source As Microsoft.SqlServer.Dts.Runtime.DtsObject, _ ByVal errorCode As Integer, ByVal subComponent As String, ByVal description As String, _ ByVal helpFile As String, ByVal helpContext As Integer, _ ByVal idofInterfaceWithError As String) As Boolean ' Add application–specific diagnostics here. 'Console.WriteLine("Error in {0}/{1} : {2}", source, subComponent, description) Return False End Function End Class
Copyright © dotNetHell.it 2002-2024
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5