The System.OutOfMemoryException error
sir I select data from database(microsoft sql server 2008) and showing in gridview.but execution time,,..error is creating the System.OutOfMemoryException error.plese help me.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Kiran Kumar TalikotiRank #814 · 2.8K reputationPosted Sep 24, 2013, 8:53 PM EDT
paste the code of selection Event.So that we can help..
Jignesh TrivediRank #16 · 50.3K reputationPosted Sep 24, 2013, 9:24 PM EDT
can you please share your code,? so that we can help you.
Thx.
mohit gupta114 reputationPosted Sep 24, 2013, 9:26 PM EDT
using System.Collections;
using System.Configuration;
using System.Data; using System.Linq;
using System.Web; using System.Web.Security;
using System.Web.UI; using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
namespace EDS
{
public partial class practice : System.Web.UI.Page
{
String strcon = ConfigurationManager.ConnectionStrings["con"].ToString();
SqlConnection Scon;
protected void Page_Load(object sender, EventArgs e)
{
Scon = new SqlConnection(strcon);
Scon.Open();
SqlCommand cmd = new SqlCommand("Select * from savedata", Scon);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
Scon.Close();
if (ds.Tables[0].Rows.Count > 0)
{
GridView1.DataSource = ds;
GridView1.DataBind();
} } } }
venkata kumarRank #5,034 · 314 reputationPosted Sep 24, 2013, 10:07 PM EDT
try the fallowing
protected void Page_Load(object sender, EventArgs e)
{
SqlDataAdapter da = new SqlDataAdapter("Select * from savedata", Scon);
DataTable dt=new DataTable();
dt.Rows.clear();
da.Fill(dt);
if (dt.Rows.Count > 0)
{
GridView1.DataSource = dt;
GridView1.DataBind();
} }
Jignesh TrivediRank #16 · 50.3K reputationPosted Sep 24, 2013, 10:09 PM EDT
Generally, this error due to there is no enough memory to continuos the process.
Please refer
http://support.microsoft.com/kb/820108
http://support.microsoft.com/kb/2020006
it might help you to resolve the issue.
Puneet GuptaRank #2,006 · 724 reputationPosted Sep 24, 2013, 10:23 PM EDT
-Xms512M -Xmx1524M
to the VM Arguments section
-----------------------------
I hope this will solve your problem