Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8796163
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:33:31+00:00 2026-06-13T23:33:31+00:00

I have an SSIS package (SQL Server 2005) that loops through a bunch of

  • 0

I have an SSIS package (SQL Server 2005) that loops through a bunch of flat files in a folder. I need to wait until the source application has finished writing the file before I can open it in my flat file import task.

I have a For Each loop container and within it a script task to execute before the Data Flow Task.

When I try to create the success connector between the Script Task and the Data Flow Task I get this error:

Could not create connector. Object reference not set to an instance of
an object.

I get that something is being set to nothing, but I can’t see it. I have DelayValidation set to true on both the Script Task and the Data Flow Task. What else am I missing?

I’m a C# guy so maybe I’m missing something obvious in the VB. Here’s the script I poached from the interwebs:

Public Sub Main()
    Dim strFileName As String = CType(Dts.Variables("FileName").Value, String)
    Dim objFS As System.IO.FileStream
    Dim bolFinished As Boolean = False

    Do
        Try
            objFS = System.IO.File.Open(strFileName, FileMode.Open, FileAccess.ReadWrite, FileShare.None)
            bolFinished = True
            objFS.Close()
        Catch ex As Exception
            System.Threading.Thread.Sleep(1000)
        End Try
    Loop

    If bolFinished Then
        Dts.TaskResult = Dts.Results.Success
    Else
        Dts.TaskResult = Dts.Results.Failure
    End If
End Sub
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T23:33:32+00:00Added an answer on June 13, 2026 at 11:33 pm

    Milen k is more than right. It looks like you have an infinite loop which is opening a file several times until it breaks down.

    You could change your code with the below suggested code. This will help you to get out of the infinite loop.

    Your current code:

    Do
        Try
            objFS = System.IO.File.Open(strFileName, FileMode.Open, FileAccess.ReadWrite, FileShare.None)
            bolFinished = True
            objFS.Close()
        Catch ex As Exception
            System.Threading.Thread.Sleep(1000)
        End Try
    Loop
    

    Suggested code:

    Do While(true)
        Try
            objFS = System.IO.File.Open(strFileName, FileMode.Open, FileAccess.ReadWrite, FileShare.None)
            bolFinished = True
            objFS.Close()
            Exit Do
        Catch ex As Exception
            System.Threading.Thread.Sleep(1000)
        End Try
    Loop
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a SSIS package that runs on a SQL Server 2005 instance that
I have a job on SQL Server 2005 running a ssis package. The package
I have an 2005 SSIS package that runs on a Windows 2003 Server hitting
I have an SSIS package that needs to be deployed to SQL Server agent.
I have a few SSIS packages that are deployed to a SQL 2005 Server
This is in regards to MS SQL Server 2005. I have an SSIS package
I have an SSIS package that I've saved under Maintenance Plans on SQL Server
I have an SSIS package (SQL 2008) that I need to connecto to an
I have an SSIS package that queries data from a view using an SQL
I have simple SSIS package where I import data from flat file into SQL

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.