System.outofmemory exception SSIS vb.net

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)

        excelConnection.Open()
        Dim ds As DataSet = New DataSet

        excelCommand.CommandTimeout = 0
        excelAdapter.Fill(ds)
        excelConnection.Close()

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

Open in new window

softdimensionsAsked:
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.

k_murli_krishnaCommented:
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:

http://kbalertz.com/952110/Error-message-Server-Integration-Services-package-Server-Business-Intelligence-Development.aspx
http://database.ittoolbox.com/groups/technical-functional/sql-server-l/ssis-memory-question-1064382

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: http://schastar.spaces.live.com/blog/cns!12BCB785A5D8B3D4!152.entry _c=BlogPart

0

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
0
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.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.