Last post Dec 11, 2013 01:51 AM by dyyo
Dec 09, 2013 02:21 PM|Manish_Tiwari_92|LINK
when i click on button then an error occure Load report failed.
My code is:
ReportDocument cryrpt = new ReportDocument();
private void button1_Click(object sender, EventArgs e)
SqlConnection sqlcon = new SqlConnection("Data Source=.\\sqlexpress;Initial Catalog=Company;Integrated Security=True");
SqlDataAdapter dap = new SqlDataAdapter("select * from tbl_addemp", sqlcon);
DataSet ds = new DataSet();
crystalReportViewer1.ReportSource = cryrpt;
Dec 10, 2013 11:48 PM|Shawn - MSFT|LINK
This error occurs in the following scenarios.
Permission issue The application must have access to the Temp folder. You have two choices to solve this (Choose any one).
ASPNET machine account to be added to the Temp directory, so we have to specify username and password attributes for tag in
Web.config file for identifying the IIS Authenticated Account or User.
<identity impersonate="true" userName="accountname" password="password" />
Invalid File path or File name
Unmanaged resources We must clean up the unmanaged resources(ReportDocument object) used in the page like below.
protected void Page_Unload(object sender, EventArgs e)
if(RptDoc != null)
For more information, you could refer to:
Dec 11, 2013 01:51 AM|dyyo|LINK
have you made sure you are using the correct crystal report version on your code?
besides, you also need to make sure that the application pool is set to operate under LOCAL SERVICE permission. Additionally, please make sure you copy the crystalreportviewer folder to your working folder.
Please mark this response as "answer" it helps you. Thanks heaps!