System.outofmemory exception SSIS

Using VS 2008 SSIS and SQL Server 2005 on a Windows Server 2008 machine with 2GB RAM

I am using the following code to read a csv file and return it as a dataset to use in other functions.  The first 2 files that I read work fine and I can perform the other functions on them.  When I get to the third file I am given a system.outofmemoryexception error.  These files are all around the same size (8 columns) and 170MB file size.

Any possible fixes would be great
Function ReadCSVFileData(ByVal filepath As String) As DataTable
        On Error GoTo ReadCSVFiledata
        Dim pathName As String = System.IO.Path.GetDirectoryName(filepath)

        Dim file As String = System.IO.Path.GetFileName(filepath)
        Dim excelConnection As OleDbConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + pathName + ";Extended Properties=Text;")
        Dim excelCommand As OleDbCommand = New OleDbCommand("select  * from " + file, excelConnection)
        Dim excelAdapter As OleDbDataAdapter = New OleDbDataAdapter(excelCommand)

        Dim ds As DataSet = New DataSet

        excelCommand.CommandTimeout = 0

        Return ds.Tables(0)
        Exit Function
        WriteTextToFile(Err.Description.ToString & filepath)
        Resume ReadCSVFileDataExit

Open in new window

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

170 MB is a very big file size. Is it possible to split that into multiple smaller files either splitting the tables horizontally/vertically. Also, check your virtual memory settings.  Changing the setting to "system managed size" can solved the problem.

Also, very good references:

If you are doing via an SSIS package, then:

Have you tried just skipping the build process I usually just copy the files, or use DTUTIL to deploy them.
Here's a post with some semi-related information:!12BCB785A5D8B3D4!152.entry _c=BlogPart

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
softdimensionsAuthor Commented:
Thanks for the info and references.  That will get me started down the path of solving the issue
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.