Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles Button1.Click
'####'[Microsoft DTSPackage Object Library]の参照設定が必要
Dim pkg As DTS.Package
Dim dtsp As New DTS.Package
Try
dtsp.LoadFromSQLServer("", "", "", DTSSQLServerStorageFlags.DTSSQLStgFlag_UseTrustedConnection, _
"", "", "", "DTS_TEST", "")
dtsp.FailOnError = True
dtsp.WriteCompletionStatusToNTEventLog = True
dtsp.Execute()
Catch e1 As SystemException 'ほとんどはこっちのエラーが返ってくる
MessageBox.Show(e1.Message.ToString)
Catch e2 As Exception
MessageBox.Show(e2.Message.ToString)
End Try
End Sub
|