Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
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();



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.
Posted
Updated 31-Oct-12 21:55pm
v2

1 solution

this causes error....
r1.Load("Reports/Service Bill.rpt");

give full path to load report
C#
string InitPath = System.Reflection.Assembly.GetExecutingAssembly.Location;
      InitPath = InitPath.Substring(0, a.IndexOf(@"\bin\"));
      r1.Load(InitPath & @"\Reports\DueFees.rpt");

Happy Coding!
:)
 
Share this answer
 

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