Ankit Agarwal

Ankit Agarwal

  • NA
  • 379
  • 253.1k

How to solve crystal report "Load report failed." error?

May 27 2015 2:28 AM
Hello,
 
How to solve crystal report "Load report failed." error after installer installed of wpf application?

Our wpf application run but error is giving when i generate crystal and export to pdf.

When run application through c# .net project so, crystal report has generated but when i generate crystal report through exe or installer wpf application so, that's given an error "Load report failed.".

How can we resolve this my crystal report generated code is:-

public void GenerateInvoice()
{
SqlConnectionClass conString = new SqlConnectionClass();
SqlCommand cmd = new SqlCommand("procGeneratePDF", conString.GetConnection());
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@InvoiceNumber", SqlDbType.Int).Value = InvoiceNum;
DataSet ds = new DataSet();
SqlDataAdapter sda = new SqlDataAdapter(cmd);
sda.Fill(ds,"InvoiceRecord");
ReportDocument InvoiceReportDocument = new ReportDocument();
//InvoiceReportDocument.Load(AppDomain.CurrentDomain.BaseDirectory + "\\" + @"\\InvoiceReport.rpt");
InvoiceReportDocument.Load("../../InvoiceReport.rpt");
InvoiceRep.SetDataSource(ds);
InvoiceRep.SetParameterValue("CustomerName", cmbCustomer.Text);
InvoiceRep.SetParameterValue("CustomerAddress", txtCustomerAdd.Text);
InvoiceRep.SetParameterValue("CustCIty", txtCity.Text);
InvoiceRep.SetParameterValue("CustState", txtState.Text);
InvoiceRep.SetParameterValue("CustPIN", txtPin.Text);
InvoiceRep.SetParameterValue("CustCountry", txtCountry.Text);
InvoiceRep.SetParameterValue("CustInvoiceNumber", txtInvoiceNumber.Text);
InvoiceRep.SetParameterValue("ProjPORef", txtPORef.Text);
InvoiceRep.SetParameterValue("CustVendorCode", txtVendorCode.Text);
InvoiceRep.SetParameterValue("AmountInWord", txtAmountInWords.Text);
}

This code is running in only development mode,
its not running in client machine or after installer installed.

please help me.

Thanks in Advance.

Ankit Agarwal
Software Engineer 

Answers (4)