Click here to Skip to main content
15,879,074 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hello,

How can we solve crystal report "Load Report Failed Error" in wpf application?

It is running only development mode but when we installed software and then generate crystal report so it is giving error "Load Report Failed".

I am using this code for generate Crystal Report:-

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");
InvoiceReportDocument.Load(AppDomain.CurrentDomain.BaseDirectory + "../../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);

}

C#
private void btnSave_Click(object sender, RoutedEventArgs e)
        {
GenerateInvoice();
}



please help me.

Thanks in Advance.
Ankit Agarwal
Software Engineer
Posted
Comments
Dianne Ramos 28-May-15 3:26am    
maybe it is looking for the file "../../InvoiceReport.rpt". Please check if this file exists in installation directory.
[no name] 28-May-15 3:29am    
but it is running in development mode. Crystal report generated in development mode but when generate after installed exe so it's giving an error.
i have already tried, my crystal report put in the installation directory. but its not working.

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