Click here to Skip to main content
15,891,657 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello,

I am using this code but load failed error its giving:-

C#
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);
          ReportDocument InvoiceReportDocument = new ReportDocument();
          InvoiceReportDocument.Load(AppDomain.CurrentDomain.BaseDirectory + "\\" + @"\\abc.rpt"); \\ Load report failed..
          InvoiceRep.SetDataSource(ds);


Please help me, my rpt file its not in the bin\debug directory.
my file put in the application directory.

I have directly added crystal report.

Please help me, how can load crystal report?

Thanks in Advance.

Ankit Agarwal
Software Engineer
Posted
Updated 4-May-15 2:22am
v3

1 solution

i will tell you how i did solved my problem with crystal report may it be useful for you....

in first you have to create crystal report in visual studio and set build action =content
right click on crystal report and then chose "export database"
so drag all data from sql_server
and to change directory the only solution i could find it was using
[text.config] file
and set this code
C#
<appsettings>
   <add key="crystala" value="C:\\Users\\normal\\Desktop\\its done\\IDcardproject\\WindowsFormsApplication1\\CrystalReport1.rpt" />

     <add key="crystalb" value="C:\\Users\\normal\\Desktop\\its done\\IDcardproject\\WindowsFormsApplication1\\CrystalReport2.rpt" />

 </appsettings>

hope be helpful ..
and if it not clear let me know ,,
 
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