How to slove out_of_Memory_Exception error in asp.net C#

Dec 29 2020 7:39 AM
public partial class MF_168 : System.Web.UI.Page
{
ReportDocument Rptdoc = new ReportDocument();
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection();
con.ConnectionString = ConfigurationManager.AppSettings["Connection"];
SqlCommand cmd = new SqlCommand("select Plant_Name from Format_Mechanical_List_Of_Misc_Equipments where id=1", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
Rptdoc.Load(Server.MapPath("~/CR_Reports/Mechanical/MF-168.rpt"));
Rptdoc.SetDataSource(ds.Tables[0].Rows.Count);
CrystalReportViewer1.RefreshReport();
CrystalReportViewer1.ReportSource = Rptdoc;
ds.Clear();
ds.Dispose();
}
protected void Page_Unload(object sender, EventArgs e)
{
Rptdoc.Close();
Rptdoc.Dispose();
GC.Collect();
}
}
 
 i am loading crystal report in C# .this code build than not page load and direct show memoryException error.
my report is 32bit  .than selected 64 bit iis and build project .
 This line Show error => Rptdoc.SetDataSource(ds.Tables[0].Rows.Count);
 error => 'CrystalDecisions.CrystalReports.Engine.DataSourceException' occurred in CrystalDecisions.CrystalReports.Engine.dll but was not handled in user code '
 
 

Answers (2)