Solved

Get errors from a DTS Package run in DOS Shell

Posted on 2004-03-30
2
346 Views
Last Modified: 2007-12-19
I'm running the process like this:

Shell("...blah\...DTSExecutor.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 UCOMIConnectionPointContainer
            cpContainer = CType(pkg, UCOMIConnectionPointContainer)
            Dim cpPoint As UCOMIConnectionPoint
            Dim PES As PackageEventsSink = New PackageEventsSink
            Dim guid As Guid = _
                New Guid("10020605-EB1C-11CF-AE6E-00AA004A34D5")
            cpContainer.FindConnectionPoint(guid, cpPoint)
            Dim intCookie As Integer
            cpPoint.Advise(PES, intCookie)
            'End - set up events sink
         
            pkg.LoadFromSQLServer("OMABC2", "sa", "", _
            DTSSQLServerStorageFlags.DTSSQLStgFlag_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!
0
Comment
Question by:_Canidae_
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 1

Accepted Solution

by:
dapcom earned 50 total points
ID: 10722672
Catching the error of the pkg.execute will give you something basic, like: Package failed because step sss failed.
You can also check the steps object properties to know if other steps status.
maybe this can help you:

        Dim oStep As [Step]
        For Each oStep In oPkg.Steps()
            strResult = strResult & "<p> Step [" & oStep.Name & "] "
            If oStep.ExecutionResult = DTSStepExecResult.DTSStepExecResult_Failure Then
                strResult = strResult & " failed<br>"
                bSuccess = False
            Else
                strResult = strResult & " succeeded<br>"
            End If
            strResult = strResult & "Task """ & _
             oPkg.Tasks.Item(oStep.TaskName).Description & """</p>"
        Next

        If bSuccess Then
            strResult = "<p>Execution of package [" & oPkg.Name & "] succeeded</p>" & strResult
        Else
            strResult = "<p>Execution of package [" & oPkg.Name & "] failed</p>" & strResult
        End If
        Return strResult


If you need more precise infi, you have the log files.

Not an expert, but I try to help...

Dan
0
 
LVL 1

Author Comment

by:_Canidae_
ID: 10722796
Thanks for your help but I managed to sort this out earlier and forgot to delete the question.  You can have the points anyway, for being the only person who offered any help.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to get time difference in minutes and seconds only between 2 dates 2 63
Help Required 2 56
$_GET call between URL 3 67
VLC command 34 79
Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question