943,846 Members | Top Members by Rank

Ad:
  • C# Discussion Thread
  • Unsolved
  • Views: 9583
  • C# RSS
Mar 10th, 2009
0

RDLC error when render report ()

Expand Post »
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 :
C# Syntax (Toggle Plain Text)
  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. }
Reputation Points: 12
Solved Threads: 0
Newbie Poster
am_dumb is offline Offline
9 posts
since Jul 2006
Mar 10th, 2009
0

Re: RDLC error when render report ()

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?
Reputation Points: 57
Solved Threads: 64
Posting Whiz in Training
mcriscolo is offline Offline
218 posts
since Apr 2008
Mar 11th, 2009
0

Re: RDLC error when render report ()

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.

C# Syntax (Toggle Plain Text)
  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. }
Reputation Points: 12
Solved Threads: 0
Newbie Poster
am_dumb is offline Offline
9 posts
since Jul 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C# Forum Timeline: Assign a variable from a combo box
Next Thread in C# Forum Timeline: About RDLC uses in VC++.net 2005





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC