Click here to Skip to main content
15,898,134 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Dear Honors,



In my windows application I've some reports.. Its works fine with .Net Solution. But When I execute with my Setup.exe it rising "Load Report Failed"....

Here my code...

If possible do alter in my code..
C#
public void PrintMethod()
{
string strPath;
lsInvNo = frmCustomerInv.gsInvNo;
string query2 = "select InvNo from tblCustomerInvoice where InvNo='" + lsInvNo + "' and State=''";
string InvoNu = DataAccess.GetSingleValue(query2);
if (InvoNu == string.Empty)
{
...
}
else
{
...
}

SqlDa = new SqlDataAdapter(Query, SqlCon);
DataTable dt = new DataTable();
dt.Clear();
SqlDa.Fill(dt);
ReportDocument REportDoct = new ReportDocument();
string reportPath = GetAppFolder();

int index = reportPath.ToLower().IndexOf("bin");
if(index >= 0)
{
reportPath = reportPath.Substring(0, index);
}

strPath = reportPath;
reportPath = reportPath + @"\Reports\FinalInvoice.rpt";
REportDoct.Load(reportPath);
REportDoct.SetDataSource(dt);
crystalReportViewer1.ReportSource = REportDoct;
crystalReportViewer1.Refresh();
REportDoct.PrintToPrinter(1, false, 0, 0);
}



Thanks in Advance..
Posted
Updated 28-Nov-11 23:52pm
v2

1 solution

Double check the reportPath when you pass it to the Load(x). At least do a MessageBox.Show(reportPath) and check that the report exists.
 
Share this answer
 
Comments
drveera 30-Nov-11 0:50am    
Dear friend.. Am already check it what do u gave the solution to me..

The problem is rising only when I execute Setup.exe file.. Not in .NET Solution.

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