执行.exe文件时加载报告失败? [英] Load Report Failed When Execute .exe file?..

查看:95
本文介绍了执行.exe文件时加载报告失败?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尊敬的荣誉,



在我的Windows应用程序中,我有一些报告.它在.Net解决方案中工作正常.但是,当我使用Setup.exe执行该程序时,它会出现加载报告失败"的情况....

这是我的代码...

如果可能的话,请更改我的代码..

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..

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..

推荐答案

将reportPath传递给Load(x)时,请仔细检查.至少执行一个MessageBox.Show(reportPath)并检查报告是否存在.
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.


这篇关于执行.exe文件时加载报告失败?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆