Click to See Complete Forum and Search --> : [RESOLVED] error - Exception of type 'System.OutOfMemoryException' was thrown.


newcoder83
November 4th, 2009, 06:25 AM
Hi all, my application occurs an error "Exception of type 'System.OutOfMemoryException' was thrown." when trying to import xlsx file to sql server.
Any help appreciated...Please Help this is very urgent

strSQL = "select * from [" & ExcelSheetName & "]"
Dim Oledbcmd As New OleDbCommand(strSQL, XLSconnection)
Dim oledbda As New OleDbDataAdapter(strSQL, XLSconnection)
Dim DS As New DataSet
ProgressBar1.PerformStep()
oledbda.Fill(DS, "DS")

dglienna
November 4th, 2009, 05:30 PM
How many records?

Why the two data sets?

Alsvha
November 6th, 2009, 01:36 AM
Well - as the exception says - you're trying to do something which you haven't got memory for.
You need to change your procedure.

newcoder83
November 6th, 2009, 03:39 AM
Yes,that's why after i deleted the dataset code, and just using data reader, the code works fine. Dataset consume much memory than data reader...