3

I have a script which exports a recordset to excel. My recordset has 139 columns. I can see in fiddler that table header of the excel is created but when it comes to write the values I face this error:

Microsoft Cursor Engine error '8007000e'

Out of memory.

/includes/ExportFunctions.inc, line 49

when I remove 5 columns then it works quite fine, even the null valued columns! It is so strange to me because I can not find any limitation for recordsets and I am sure I have disposed all the objects required. Here is my code:

Response.Write "<table>" & vbCrLf
Response.Write "<tr>" & vbCrLf
For intItem = 0 To rstResult.Fields.count - 1
    Response.Write "<th>" & rstResult(intItem).Name & "</th>" & vbCrLf
Next    
Response.Write "</tr>" & vbCrLf
dim index 
index = 0 
Do While Not rstResult.EOF
    Response.Write "<tr>" & vbCrLf
    For intItem = 0 To rstResult.Fields.count - 1
        Response.Write "<td><nobr>"
        If IsNull(rstResult(intItem).Value) Then
            Response.Write " "
        else
            Response.Write rstResult(intItem).Value
        end if
        Response.Write "</nobr></td>" & vbCrLf
    Next    
    Response.Write "</tr>" & vbCrLf

    Response.Flush

    rstResult.MoveNext
LOOP

The error refers to line 49 which is

Do While Not rstResult.EOF

Does anyone has an idea about this?

Leila
  • 232
  • 6
  • 15
  • Too many columns for `ADODB.Recordset` to deal with perhaps? *(don't know just a guess)*. – user692942 Jul 16 '15 at 14:16
  • What database are you using? You have provided no details about the environment, you using a server, local desktop, IIS 5 - 7+, MySQL, SQL Server *(which version)*, some other RDMS ?? – user692942 Jul 16 '15 at 14:19
  • Different language same error. - http://stackoverflow.com/q/16416546/692942 – user692942 Jul 16 '15 at 14:24
  • I was thinking about too many columns for `ADODB.Recordset` then I tried a query with 150 columns like this `select 1 as 1 , 2 as 2 , ..., 150 as 150` and the code worked just fine! Really strange – Leila Jul 16 '15 at 23:50
  • I am using SQL server 2014, IIS 7 in Windows server 2012 R2 – Leila Jul 16 '15 at 23:55
  • Well c# has much more options in this respect. I am not sure if vb has the same, I will search a little bit. Thanks for your response mate – Leila Jul 17 '15 at 00:01

0 Answers0