Imports System.Web.Services
Imports System.Data
Imports System.Data.SqlClient
Imports System.Runtime.InteropServices
Imports DTS
<System.Web.Services.WebService(Namespace:="[URL unfurl="true"]http://tempuri.org/ReportingWebService/RWS")>[/URL] _
Public Class RWS
Inherits System.Web.Services.WebService
<WebMethod()> Public Function ForceDTSsynch(ByVal TestMe As String)
'//Created: 05/03/2004 by C. Michael Wells
'//Purpose: force DTS package synchronization
'//Arguments: NONE
'//REFERENCES: Microsoft DTSPackage Object Library (COM)
'// located at: C:\Program Files\Microsoft SQL Server\80\Tools\Binn\dtspkg.dll
'//Returns: integer value, translated as follows:
'// 1: Job Completed Successfully
'// 2: COM error
'// 3: Other error
'//declare variables:
Dim pkg As New DTS.Package
Try
pkg.LoadFromSQLServer("servername", "userid", "password", _
DTSSQLServerStorageFlags.DTSSQLStgFlag_Default, _
Nothing, Nothing, Nothing, "myPackage", Nothing)
pkg.Execute()
pkg.UnInitialize()
pkg = Nothing
Return 1 '//success
Catch exc As System.Runtime.InteropServices.COMException
Return exc.ToString '//COM error
Catch exc As Exception
Return 3 '//unspecified error
End Try
End Function
End Class