Thanks, that worked. I really appreaciate all you help. Unfortunately, we are still having a problem.
Here’s the issue we’re having:
We are running large excel reports that have the following form:
Record 1
Note1
Note 2
Record 2
Note 3
Note 4
Note 5
(etc)
There is one Data Reader(objDataReader) that retrieves the main Records. Then, cycling through the returned record set, we use a second Data Reader(objDataReader2) to retrieve the Notes for that Record. The code snippet looks like this:
‘retrieve main record set
sSqlStr = "SELECT * FROM Record_Table
objCommand = New OleDbCommand(sSqlStr, OBJdbConn)
objDataReader = objCommand.ExecuteReader(CommandBehavior.CloseConnection)
‘read one record at a time
While objDataReader.Read()
‘write Record to next excel row
worksheet.Cells(i, 0).PutValue(Str(objDataReader("FileNo")))
worksheet.Cells(i, 1).PutValue(objDataReader("Matter"))
worksheet.Cells(i, 2).PutValue(objDataReader("LoanNumber"))
worksheet.Cells(i, 3).PutValue(objDataReader("Address"))
worksheet.Cells(i, 4).PutValue(sdate(objDataReader("Date")))
worksheet.Cells(i, 5).PutValue(objDataReader("Outsourcer_Name"))
worksheet.Cells(i, 6).PutValue(objDataReader("Broker_Name"))
worksheet.Cells(i, 7).PutValue(sdate(objDataReader("OpenDate")))
i = i + 1
‘retrieve Notes for the current record
sSqlStr = "SELECT * FROM Notes_Table WHERE FileNo = " & Trim(objDataReader("FileNo")
objCommand2 = New OleDbCommand(sSqlStr, OBJdbConn)
objDataReader2 = objCommand2.ExecuteReader(CommandBehavior.CloseConnection)
‘read each Note
While objDataReader2.Read()
‘write Note to next excel row
worksheet.Cells(i, 1).PutValue(sdate(objDataReader2("Date")))
worksheet.Cells(i, 2).PutValue(objDataReader2("Note"))
i = i + 1
End While
objCommand2.Dispose()
i = i + 1
End While
The above is simplified a bit. The main query is actually parameterized and returns different record set depending on user input. Normally, the Report runs fine … that is until the main Record set grows to about 1050. At that point, the server throws an OUT OF MEMORY Exception. It doesn’t matter how many Notes are retrieved. (I can include “TOP 0” in the Notes query and I still get the same Exception at about 1050 records) However if I turn off the Notes all together (by commenting out the whole Notes section) the Report runs as many main Records as I need.
Two questions:
1) Do you have any theories about what could be causing this problem? Do you know if there is some issue with either SQL Server or ASPOSE that requires a certain amount contiguous memory? We’d really like to know what’s causing this issue.
2) We are considering moving to a 64-bit server to improve performance. Will ASPOSE work in a 64-bit environment?
Any help you could provide would be appreciated