RDLC error when render report ()

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: Jul 2006
Posts: 7
Reputation: am_dumb is an unknown quantity at this point 
Solved Threads: 0
am_dumb's Avatar
am_dumb am_dumb is offline Offline
Newbie Poster

RDLC error when render report ()

 
0
  #1
Mar 10th, 2009
i've got an error when render report. am stuck here, please help me..
error like :

Microsoft.Reporting.WinForms.LocalProcessingException: An error occurred during local report processing. ---> Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: One or more parameters required to run the report have not been specified.

my code is :
  1. private void RenderReport()
  2. {
  3. LocalReport localReport = new LocalReport();
  4. localReport.ReportPath = PemFormatHelper.GetReportFile("test.rdlc");
  5.  
  6. DataAccess.SPHPDa sphpDa = new DataAccess.SPHPDa();
  7. dtHdrSource = sphpDa.ReportHdrSPHP(sphp.SphpId, ConnectionSession.LoginID, sphp.SphpType);
  8.  
  9.  
  10. List<ReportParameter> paramCollection = new List<ReportParameter>();
  11. paramCollection.Add(new ReportParameter("NamaKanwil", dtHdrSource.Rows[0]["NM_KANWIL"].ToString()));
  12. paramCollection.Add(new ReportParameter("NamaKPP", dtHdrSource.Rows[0]["NM_KPP"].ToString()));
  13. paramCollection.Add(new ReportParameter("AlamatKPP", dtHdrSource.Rows[0]["ALAMAT_KPP"].ToString()));
  14. paramCollection.Add(new ReportParameter("KotaKPP", dtHdrSource.Rows[0]["KOTA_KPP"].ToString()));
  15. paramCollection.Add(new ReportParameter("KdPosKPP", dtHdrSource.Rows[0]["KD_POS_KPP"].ToString()));
  16. paramCollection.Add(new ReportParameter("KTKPos", dtHdrSource.Rows[0]["KTK_POS"].ToString()));
  17. paramCollection.Add(new ReportParameter("TelpKpp", dtHdrSource.Rows[0]["TELP_KPP"].ToString()));
  18. paramCollection.Add(new ReportParameter("FaxKpp", dtHdrSource.Rows[0]["FAX_KPP"].ToString()));
  19. paramCollection.Add(new ReportParameter("CompCtr", dtHdrSource.Rows[0]["COMP_CTR"].ToString()));
  20. paramCollection.Add(new ReportParameter("SMSCenter", dtHdrSource.Rows[0]["SMS"].ToString()));
  21. paramCollection.Add(new ReportParameter("TollFree", dtHdrSource.Rows[0]["TOLL_FREE"].ToString()));
  22.  
  23. ReportDataSource dtSourceHeader = new ReportDataSource("DataReport_Sphp", dtHdrSource);
  24.  
  25. localReport.DataSources.Add(dtSourceHeader);
  26.  
  27. string reportType = "PDF";
  28. string mimeType;
  29. string encoding;
  30. string fileNameExtension;
  31.  
  32. string deviceInfo =
  33. "<DeviceInfo>" +
  34. " <OutputFormat>PDF</OutputFormat>" +
  35. " <PageWidth>8.5in</PageWidth>" +
  36. " <PageHeight>11in</PageHeight>" +
  37. " <MarginTop>0.5in</MarginTop>" +
  38. " <MarginLeft>1in</MarginLeft>" +
  39. " <MarginRight>1in</MarginRight>" +
  40. " <MarginBottom>0.5in</MarginBottom>" +
  41. "</DeviceInfo>";
  42.  
  43. Warning[] warnings;
  44. string[] streams;
  45. byte[] renderedBytes;
  46.  
  47. //Render the report
  48.  
  49. localReport.Render(reportType, deviceInfo, out mimeType, out encoding, out fileNameExtension, out streams, out warnings);
  50. }
Reply With Quote Quick reply to this message  
Join Date: Apr 2008
Posts: 70
Reputation: mcriscolo is an unknown quantity at this point 
Solved Threads: 18
mcriscolo mcriscolo is offline Offline
Junior Poster in Training

Re: RDLC error when render report ()

 
0
  #2
Mar 10th, 2009
I can't be 100% sure, as I'm not sure where you're getting your data, but you don't seem to be doing anything with the "paramCollection" data structure. Shouldn't that be set somewhere in one of the parameters that is going into the report?
-Mike
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 7
Reputation: am_dumb is an unknown quantity at this point 
Solved Threads: 0
am_dumb's Avatar
am_dumb am_dumb is offline Offline
Newbie Poster

Re: RDLC error when render report ()

 
0
  #3
Mar 11th, 2009
thanx for reply, the code is run away now.
my mistake is, localreport going to be render.
when i use reportviewer to render it normaly work.
this my code,.... i hope anyone have this same problem can solve that.

  1. private void RenderReport()
  2. {
  3. LocalReport localReport = new LocalReport();
  4. //localReport.ReportPath = PemFormatHelper.GetReportFile("SPHPView.rdlc");
  5.  
  6. //header
  7. DataAccess.SPHPDa sphpDa = new DataAccess.SPHPDa();
  8. dtHdrSource = sphpDa.ReportHdrSPHP(sphp.SphpId, ConnectionSession.LoginID, sphp.SphpType);
  9.  
  10. ReportViewer ReportViewer = new ReportViewer() ;
  11.  
  12. List<ReportParameter> paramCollection = new List<ReportParameter>();
  13. paramCollection.Add(new ReportParameter("NamaKanwil", dtHdrSource.Rows[0]["NM_KANWIL"].ToString()));
  14. paramCollection.Add(new ReportParameter("NamaKPP", dtHdrSource.Rows[0]["NM_KPP"].ToString()));
  15. paramCollection.Add(new ReportParameter("AlamatKPP", dtHdrSource.Rows[0]["ALAMAT_KPP"].ToString()));
  16. paramCollection.Add(new ReportParameter("KotaKPP", dtHdrSource.Rows[0]["KOTA_KPP"].ToString()));
  17. paramCollection.Add(new ReportParameter("KdPosKPP", dtHdrSource.Rows[0]["KD_POS_KPP"].ToString()));
  18. paramCollection.Add(new ReportParameter("KTKPos", dtHdrSource.Rows[0]["KTK_POS"].ToString()));
  19. paramCollection.Add(new ReportParameter("TelpKpp", dtHdrSource.Rows[0]["TELP_KPP"].ToString()));
  20. paramCollection.Add(new ReportParameter("FaxKpp", dtHdrSource.Rows[0]["FAX_KPP"].ToString()));
  21. paramCollection.Add(new ReportParameter("CompCtr", dtHdrSource.Rows[0]["COMP_CTR"].ToString()));
  22. paramCollection.Add(new ReportParameter("SMSCenter", dtHdrSource.Rows[0]["SMS"].ToString()));
  23. paramCollection.Add(new ReportParameter("TollFree", dtHdrSource.Rows[0]["TOLL_FREE"].ToString()));
  24.  
  25. ReportDataSource dtSourceHeader = new ReportDataSource("DataReport_Sphp", dtHdrSource);
  26. //localReport.DataSources.Add(dtSourceHeader);
  27.  
  28. dtDtlSource = sphpDa.ReportDtlSPHP(sphp.SphpId, ConnectionSession.LoginID, sphp.SphpType);
  29. ReportDataSource dtSourceDetail = new ReportDataSource("DataReport_dtSphpDtlTbl", dtDtlSource);
  30.  
  31. ReportViewer.LocalReport.DataSources.Clear();
  32. ReportViewer.LocalReport.ReportPath = PemFormatHelper.GetReportFile("SPHPView.rdlc");
  33. ReportViewer.LocalReport.DataSources.Add(dtSourceHeader);
  34. ReportViewer.LocalReport.DataSources.Add(dtSourceDetail);
  35. ReportViewer.LocalReport.SetParameters(paramCollection);
  36. ReportViewer.RefreshReport();
  37.  
  38. Export(ReportViewer.LocalReport);
  39.  
  40.  
  41. }
  42.  
  43. private void Export(LocalReport report)
  44. {
  45.  
  46. string deviceInfo =
  47. "<DeviceInfo>" +
  48. " <OutputFormat>EMF</OutputFormat>" +
  49. " <PageWidth>8.5in</PageWidth>" +
  50. " <PageHeight>11in</PageHeight>" +
  51. " <MarginTop>0in</MarginTop>" +
  52. " <MarginLeft>0in</MarginLeft>" +
  53. " <MarginRight>0in</MarginRight>" +
  54. " <MarginBottom>0in</MarginBottom>" +
  55. "</DeviceInfo>";
  56.  
  57. Warning[] warnings;
  58. m_streams = new List<Stream>();
  59.  
  60. report.Render("Image", deviceInfo, CreateStream, out warnings);
  61.  
  62. foreach (Stream stream in m_streams)
  63. stream.Position = 0;
  64. }
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the C# Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC