出现加载报告失败错误是什么问题 [英] Load Report Failed Error Occurs What is the problem

查看:104
本文介绍了出现加载报告失败错误是什么问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

con = new SqlConnection("Server=(local);initial catalog=ServiceTax;Trusted_Connection=True");
            con.Open();
            string str = "select * from diesel where Billno='" + cb_billno.SelectedItem + "'";
            SqlCommand com = new SqlCommand(str, con);
            SqlDataAdapter sqlda = new SqlDataAdapter(com);
            DataSet ds = new DataSet();
            sqlda.Fill(ds, "diesel");
            con.Close();

            ReportDocument r1 = new ReportDocument();
            r1.Load("Reports/Service Bill.rpt");
            r1.SetDataSource(ds);
            crystalReportViewer1.ReportSource = r1;
            crystalReportViewer1.RefreshReport();




在运行模式下,我有一个文本框和一个按钮.在该文本框中,输入特殊的Bill no并单击按钮错误显示为加载报告失败".
Erro在r1.Load("Reports/Service Bill.rpt")中显示; (加载reprot失败)

Varchar中的Billno数据类型.

对于示例R004,并单击按钮,该部分帐单数据要在运行模式下显示在Crystal Report Viewer中.




In the run mode i have one textbox and one button.in that textbox i type the partucular Bill no and click the button Error Shows as Load Report Failed.
Erro Shows in r1.Load("Reports/Service Bill.rpt"); (Load reprot Failed)

Billno Datatype in Varchar.

For Example R004 and click the button the partiuclar Bill datas want to be appear in crystal report Viewer in Run Mode.

推荐答案

这会导致错误.... >
this causes error....
r1.Load("Reports/Service Bill.rpt");


给出加载报告的完整路径


give full path to load report

string InitPath = System.Reflection.Assembly.GetExecutingAssembly.Location;
      InitPath = InitPath.Substring(0, a.IndexOf(@"\bin\"));
      r1.Load(InitPath & @"\Reports\DueFees.rpt");


祝您编码愉快!
:)


Happy Coding!
:)


这篇关于出现加载报告失败错误是什么问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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