Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > .NET Web Services
|
.NET Web Services Discussions about .NET XML Web Service technologies including ASMX files, WSDL and SOAP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Web Services section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 6th, 2004, 12:09 AM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 101
Thanks: 0
Thanked 0 Times in 0 Posts
Default excel export giving memory error

Hi
I am exporting the data to excel.If i have huge data its giving memroy error means it creates an enormous amount of objects in memory and the .Net framework restarts the asp.net process to prevent it from eating all the server's memory.
This means that all asp.net applications running on that server would be restarted (loosing connections, sessions data...)

log shows below error
aspnet_wp.exe (PID: 2616) was recycled because memory consumption exceeded the 305 MB (60 percent of available RAM).

my code is


 Dim adapter As New SqlDataAdapter(sql, con) '
        Dim myDataSet As New DataSet
        Try
            adapter.Fill(myDataSet, "ds")
        Catch ex As Exception

        End Try

        Response.Clear()
        Response.Charset = ""
        Response.ContentType = "application/vnd.ms-excel" ' set the content type
        Response.AddHeader("Content-Disposition", " attachment; filename=urreportname.xls")
        Dim stringWrite As New System.IO.StringWriter
        Dim htmlWrite As New System.Web.UI.HtmlTextWriter(stringWrite)
        Dim dg As New System.Web.UI.WebControls.DataGrid
        dg.DataSource = myDataSet.Tables(0) ' it is here where u need to assign ur datatable
        dg.DataBind()
        dg.RenderControl(htmlWrite)
        Response.Write(stringWrite.ToString)
        Response.End()







Similar Threads
Thread Thread Starter Forum Replies Last Post
Error giving when i create the Subdomain Surjit Classic ASP Professional 0 April 18th, 2008 06:17 AM
Export excel error fomula suradech ASP.NET 1.0 and 1.1 Basics 0 March 15th, 2007 09:32 PM
mysql_num_rows() => Giving Error? Cybot MySQL 4 September 12th, 2006 12:07 PM
This piece of code is giving an error sourik C# 2 July 15th, 2006 09:18 AM
This piece of code is giving an error sourik Classic ASP Databases 1 July 14th, 2006 09:10 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.