Click here to Skip to main content
15,884,099 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I have problem to put variables to reportviewer.
First I put variables to parametrs and then to reportviewer.
Code looks like that:
C#
jodb baza_win = new jodb(.....data.....to.....connection......SQL);
List<DaneRaportu> lista = baza_win.pobierz_rap_view(......query......SQL)
reportViewer1.ProcessingMode = ProcessingMode.Local;
LocalReport localReport = reportViewer1.LocalReport;

reportViewer1.LocalReport.DataSources.Clear(); //clear report
reportViewer1.LocalReport.ReportEmbeddedResource = "Raporting.Report_Promo.rdlc"; // bind reportviewer with .rdlc

Microsoft.Reporting.WinForms.ReportDataSource dataset = new Microsoft.Reporting.WinForms.ReportDataSource("DataSet1", lista); // set the datasource
reportViewer1.LocalReport.DataSources.Add(dataset);
dataset.Value = lista;

            string data_rap = "Dataprobna";   //variables that I won't put in reportviewer
            ReportParameter nowydataod = new ReportParameter("dataodview", data_rap);  //dataodview this is name of parameter in design report
            this.reportViewer1.LocalReport.SetParameters(nowydataod);


Next in report I put parameter to textbox. Expression looks like that: Parameters!dataodview.Value

When I start program I get this communication:
An error occurred during local report processing
In details:
Microsoft.Reporting.WinForms.LocalProcessingException: An error occurred during local report processing. ---> Microsoft.Reporting.DefinitionInvalidException: The definition of the report '' is invalid. ---> Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: An unexpected error occurred in Report Processing. ---> System.UnauthorizedAccessException: Access to the path 'C:\Users\User\AppData\Local\Temp\expression_host_1f2d7bdeb7b24b8a9d99ff74d15a1b60.dll' is denied.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)

The strange thing is that when I start program in Start Debugging everything is ok but when I start program in Start Without Debugging I have bug.

Maybe someone knows what happened?
Posted

1 solution

Hi,

It looks like your compiler trying to access some Temp folder file and it is being used by other process. You can try to remove all temp files, clean project, change some code file so project will be rebuild. Although i am not sure about the solution. but nothing wrong in trying out with the options.

Thanks
 
Share this answer
 
Comments
Kris_C# 9-Oct-14 4:38am    
Unfortunately, the file appears when I create a report so remove temp does nothing helps!
AmitGajjar 9-Oct-14 10:52am    
sounds like some problem with your report. Are you able to add variable in other report ?

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