Click here to Skip to main content
15,881,248 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using following code to bind crystal report in my asp.net web application

C#
rdoc.Load(Server.MapPath("~//Reports/CR_ProfitReceipt.rpt"));//sub_profit.rpt   CR_ProfitReceipt
                       rdoc.SetDataSource(dt.Tables[0]);


                       CrystalReportViewer1.ReportSource = rdoc;
                       Session["Report"] = rdoc;
                       //DtDatasource = rdoc;
                       CrystalReportViewer1.DataBind();



and following code to export it to pdf or any format using report viewer export button
SQL
if (!IsPostBack)
           {
}
else
{
C#
CrystalReportViewer1.ReportSource = Session["Report"];
}


the export function works perfectly on local server and it works in print button too but on server it shows error like

"Attempted to read or write protected memory. This is often an indication that other memory is corrupt"
Posted
Comments
Samatha Reddy G 30-Sep-14 8:48am    
i have small doubt, when you are binding this report means while page loading or button click event.

if you are binding page load event instead of using page load event once you bind that method in preInIt event.

or

if you are binding in click event you can call that method in if(isPostback){
bindreport()
}
and if(!isPostback)
{
bindreport() // here also you need to call
}

try like this

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