dip s

dip s

  • 1.4k
  • 256
  • 75.6k

ASP.NET MVC Crystal Report parameter value is not displayed in report

Jul 13 2020 3:50 AM
I have a crystal report to which i am passing 3 parameters - ID, clientname and address. Code is as follows
  1. ReportDocument cryRpt = new ReportDocument();  
  2. MySqlCommand objcmd = new MySqlCommand("rptreport", conn);  
  3. objcmd.CommandType = CommandType.StoredProcedure;  
  4.   
  5. objcmd.Parameters.AddWithValue("ID", ID);  
  6. objcmd.Parameters.AddWithValue("clientName", clientname);  
  7. objcmd.Parameters.AddWithValue("Address", address)  
  8.   
  9. MySqlDataAdapter da = new MySqlDataAdapter();  
  10. DataTable dt = new DataTable();  
  11. da.SelectCommand = objcmd;  
  12. da.Fill(dt);  
  13. cryRpt.Load("C:/Report/" + reportname + ".rpt");  
  14. cryRpt.SetDataSource(dt);  
  15.   
  16.   
  17. cryRpt.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat,"C:/Report/" + reportname + ".pdf");  
  18. byte[] bytes = File.ReadAllBytes("C:/Report/" + reportname + ".pdf");  
  19. result = Convert.ToBase64String(bytes);  

While designing report, in report header section I need to show client name and address. So from Field explorer window , in parameter fields , I just drag cilentname and address and drop in report header section.

When I run or print the report; client name and address are not getting displayed in report header section. It shows blank in report header section.

How to show these parameter fields in report?

Any help would be appreciated. Thank you.

Answers (2)