Click here to Skip to main content
15,920,217 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
While binding a grid with more than 3000 record i am getting error like
'System.OutOfMemoryException' was thrown,



Stack

OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.]
System.String.GetStringForStringBuilder(String value, Int32 startIndex, Int32 length, Int32 capacity) +29
System.Text.StringBuilder..ctor(String value, Int32 startIndex, Int32 length, Int32 capacity) +104
System.Data.DataSet.SerializeDataSet(SerializationInfo info, StreamingContext context, SerializationFormat remotingFormat) +856
System.Data.DataSet.GetObjectData(SerializationInfo info, StreamingContext context) +18
System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter) +7630106
System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.Serialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter) +51
System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck) +410
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck) +134
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph) +13
System.Web.UI.ObjectStateFormatter.SerializeValue(SerializerBinaryWriter writer, Object value) +842

[ArgumentException: Error serializing value 'System.Data.DataSet' of type 'System.Data.DataSet.']
System.Web.UI.ObjectStateFormatter.SerializeValue(SerializerBinaryWriter writer, Object value) +3319
System.Web.UI.ObjectStateFormatter.Serialize(Stream outputStream, Object stateGraph) +110
System.Web.UI.ObjectStateFormatter.Serialize(Object stateGraph) +57
System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Serialize(Object state) +4
System.Web.UI.Util.SerializeWithAssert(IStateFormatter formatter, Object stateGraph) +37
System.Web.UI.HiddenFieldPageStatePersister.Save() +79
System.Web.UI.Page.SavePageStateToPersistenceMedium(Object state) +105
System.Web.UI.Page.SaveAllState() +236
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1099

I needed to display one month record so its coming more than 3000,so pls help on this.Thanks in advance
Posted
Updated 6-Jan-10 17:33pm
v2

The error message speaks for itself. The big question is, why are you showing 3000 records in a single page, instead of offering paging and filtering, and what are you displaying in order for your code to use all your memory ?
 
Share this answer
 
yes you must use paging or filtering otherwise end user will be frustrated. by using filtering you can display selected date transactions. But my suggestion is use paging with filtering.
 
Share this answer
 
Presumably you're running out of memory. We really can't tell you much more from the little information you've given us.

If your table contains many columns, you could try trimming them down a bit in your query.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900