将参数放在reportviewer中的问题 [英] Problem with putting a parameter in the reportviewer

查看:61
本文介绍了将参数放在reportviewer中的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,



我有把变量放到reportviewer的问题。

首先我把变量放到参数中然后再报告给viewviewer。 br />
代码如下:

Hello,

I have problem to put variables to reportviewer.
First I put variables to parametrs and then to reportviewer.
Code looks like that:

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);





接下来在报告中我将参数放到文本框中。表达式看起来像这样:参数!dataodview.Value



当我启动程序时,我得到了这个通信:

本地报告处理期间发生错误

详细信息:

Microsoft.Reporting.WinForms.LocalProcessingException:本地报告处理期间发生错误。 ---> Microsoft.Reporting.DefinitionInvalidException:报告''的定义无效。 ---> Microsoft.ReportingServices.ReportProcessing.ReportProcessingException:报表处理中发生意外错误。 ---> System.UnauthorizedAccessException:拒绝访问路径'C:\Users\User\AppData\Local\Temp\expression_host_1f2d7bdeb7b24b8a9d99ff74d15a1b60.dll'。

在System.IO .__错误。 WinIOError(Int32 errorCode,String maybeFullPath)



奇怪的是,当我在Start Debugging中启动程序时一切正常但是当我在Start Without Debugging中启动程序时我有错误。



也许有人知道发生了什么事?



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?

推荐答案





看起来您的编译器试图访问某些Temp文件夹文件,并且正在被其他进程使用。您可以尝试删除所有临时文件,清理项目,更改一些代码文件,以便重建项目。虽然我不确定解决方案。尝试选项时没有错。



谢谢
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


这篇关于将参数放在reportviewer中的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆