Results 1 to 4 of 4
  1. #1
    m00958
    Guest

    VB & DTS (VB/SQL Server)

    I am trying to run a DTS package stored on the SQL Server from within VB (Version 6)

    It works fine until I try and mke use of the events associated with the package. I have declared the variable to use WithEvents, and declared the five events (onStart, OnError, OnProgress, OnQueryCancel, OnFinish).

    Whenever the OnProgress event is called the whole thing blows up! And I mean blows up! It hangs VB completely. What is that all about?!

    If anyone wants to see the code I can post it.

    Cheers
    George

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: VB & DTS (VB/SQL Server)

    Does the package work if you run it from SQL Server? You need to determine whether it's your code or the package itself that is failing. Even valid DTS packages can fail unexpectedly, so start there. Then I'd say you'll need to post your code. Otherwise, we're just guessing.
    Charlotte

  3. #3
    m00958
    Guest

    Re: VB & DTS (VB/SQL Server)

    The package works fine when run from SQL Server, but hangs up when I use the WithEvents in VB.

    If I just ignore the OnProgress, and keep the end users in the dark, then it'll run fine.

    Please find the code attached... any help would be greatly received!

    Cheers
    George

  4. #4
    m00958
    Guest

    Re: VB & DTS (VB/SQL Server)

    PROBLEM SOLVED!

    This is a warning to anyone who is trying to run DTS packages in VB.... MAKE SURE YOU SET EACH STEP TO EXECUTE IN THE MAIN THREAD!

    Use the following code to do it:

    ' Set ExecuteInMainThread for ALL Steps
    For iCount = 1 To m_oPackage.Steps.count
    m_oPackage.Steps(iCount).ExecuteInMainThread = True
    Next

    Cheers
    George

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •