_Canidae_
asked on
Get errors from a DTS Package run in DOS Shell
I'm running the process like this:
Shell("...blah\...DTSExecu tor.exe", AppWinStyle.NormalFocus, True)
This is most of the important code that does everything in my DTSExecutor program:
pkg = New DTS.Package
'Begin - set up events sink
Dim cpContainer As UCOMIConnectionPointContai ner
cpContainer = CType(pkg, UCOMIConnectionPointContai ner)
Dim cpPoint As UCOMIConnectionPoint
Dim PES As PackageEventsSink = New PackageEventsSink
Dim guid As Guid = _
New Guid("10020605-EB1C-11CF-A E6E-00AA00 4A34D5")
cpContainer.FindConnection Point(guid , cpPoint)
Dim intCookie As Integer
cpPoint.Advise(PES, intCookie)
'End - set up events sink
pkg.LoadFromSQLServer("OMA BC2", "sa", "", _
DTSSQLServerStorageFlags.D TSSQLStgFl ag_Default , _
"", "", "", "test dts", Nothing)
Console.WriteLine("PACKAGE EXECUTION BEGINNING")
pkg.Execute()
Console.WriteLine("PACKAGE EXECUTION COMPLETED")
Console.WriteLine("The package contained {0} steps.", _
pkg.Steps.Count.ToString)
pkg.UnInitialize()
pkg = Nothing
cpPoint.Unadvise(intCookie )
cpPoint = Nothing
cpContainer = Nothing
PES = Nothing
If something simple goes wrong, like it can't find the sheet in in the Excel workbook it's getting its data from, I want to throw the error and for the user to have a fairly accurate idea of where things've gone wrong.
This is being done in a major hurry and has to be finished soon. I've only had 5 minutes to sit down and look at it and now I'm going home and it'd be nice to know what to do when I arrive tomorrow morning!
If somebody could point out how I get the error, that would be much appreciated! Just catch and exception as normal? I don't have time to try it! Argh!
Shell("...blah\...DTSExecu
This is most of the important code that does everything in my DTSExecutor program:
pkg = New DTS.Package
'Begin - set up events sink
Dim cpContainer As UCOMIConnectionPointContai
cpContainer = CType(pkg, UCOMIConnectionPointContai
Dim cpPoint As UCOMIConnectionPoint
Dim PES As PackageEventsSink = New PackageEventsSink
Dim guid As Guid = _
New Guid("10020605-EB1C-11CF-A
cpContainer.FindConnection
Dim intCookie As Integer
cpPoint.Advise(PES, intCookie)
'End - set up events sink
pkg.LoadFromSQLServer("OMA
DTSSQLServerStorageFlags.D
"", "", "", "test dts", Nothing)
Console.WriteLine("PACKAGE
pkg.Execute()
Console.WriteLine("PACKAGE
Console.WriteLine("The package contained {0} steps.", _
pkg.Steps.Count.ToString)
pkg.UnInitialize()
pkg = Nothing
cpPoint.Unadvise(intCookie
cpPoint = Nothing
cpContainer = Nothing
PES = Nothing
If something simple goes wrong, like it can't find the sheet in in the Excel workbook it's getting its data from, I want to throw the error and for the user to have a fairly accurate idea of where things've gone wrong.
This is being done in a major hurry and has to be finished soon. I've only had 5 minutes to sit down and look at it and now I'm going home and it'd be nice to know what to do when I arrive tomorrow morning!
If somebody could point out how I get the error, that would be much appreciated! Just catch and exception as normal? I don't have time to try it! Argh!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER