Click here to Skip to main content
15,886,724 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
in my project I build a windows service to generate reports on a schedule ,it takes its data source from wcf service but when I want to use windows form report save to pdf method this exception appear An error occurred during local report processing.
while I have created localreport.rdlc and set a dataset to it from wcf service
and every thing is going alright note:I tried in windows form application
what's wrong please help.

this is my code
C#
BasicHttpBinding binding = new BasicHttpBinding();
                EndpointAddress address = new EndpointAddress("http://IPaddress:Port/Services/Myservice.svc");
                ChannelFactory<Services.Myservice> driver = new ChannelFactory<Services.Myservice>(binding, address);
                Services.Myservice channel = driver.CreateChannel();

                Warning[] warnings;
                string[] streamIds;
                string mimeType = string.Empty;
                string encoding = string.Empty;
                string extension = string.Empty;

                ReportDataSource datasource = new ReportDataSource("DataSetName",channel.MyMethod());
                // Setup the report viewer object and get the array of bytes
                ReportViewer viewer = new ReportViewer();
                viewer.ProcessingMode = ProcessingMode.Local;
                viewer.LocalReport.ReportPath = @"Reports\Report1.rdlc";
                viewer.LocalReport.DataSources.Add(datasource); // Add datasource here

                
                //Here is the part the program stop at 
                byte[] bytes = viewer.LocalReport.Render("PDF", null, out mimeType, out encoding, out extension, out streamIds, out warnings);

                string date = DateTime.Now.ToString();
                System.IO.File.Create(@"E:\Report_"+date+".pdf");
                System.IO.File.WriteAllBytes(@"E:\Report_" + date + ".pdf", bytes);
Posted
Updated 13-May-15 1:49am
v2

1 solution

I figure it out ,the solution is to put the full path of the local report like
C:users\user\documents\.........
 
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