Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > .NET Web Services
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
.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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 6th, 2004, 12:09 AM
Friend of Wrox
 
Join Date: Sep 2003
Location: , , .
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()


Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 10:40 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.