打开远程RDL使用.NET报表查看器 [英] Opening Remote RDL with .NET Report Viewer
问题描述
我远程存储RDL在二进制格式的SQL Server数据库。我想用报表查看器控件来显示报告。
这似乎是一个简单的概念,但我不断寻找冲突的教程具有几种不同的方法......其中没有我可以开始工作。
我是正确的思维,所有我需要的是报表查看器控件得到这个工作?如果是这样,怎么可能打开一个远程存储的.rdl文件?
我也有上已经储存在一个字符串的内容RDL一个变量...不知道如果这能帮助?因此,无论我可以用这个字符串或从数据库中拉出的.rdl ...
我是新手到.NET所以我不知道如何以最佳方式处理这个......到目前为止,我有以下几点:
的ReportViewer R =新的ReportViewer();
//通过RDL报告查看器
r.ProcessingMode = ProcessingMode.Remote;
您需要真正将其设置为本地处理模式并不遥远。
我只装过一个RDL从DLL不是一个数据库,但我想看看下面的API,因为它可能有一个超负荷接受一个字符串或您的字符串转换成流。
reportViewer.LocalReport.LoadReportDifinition
下面是code我用从DLL加载(可能有助于在上下文中看到)
大会总成= Assembly.LoadFrom(MyReports.dll);
流流= assembly.GetManifestResourceStream(Reports.MyReport.rdlc);
reportViewer.LocalReport.LoadReportDifinition(流);
I store rdl's remotely in a sql server database in binary format. I would like to use the report viewer control to display the report.
This seems like a simple concept but I keep finding conflicting tutorials which have several different approaches...none of which I can get to work.
Am I right in thinking that all I need is the report viewer control to get this working? If so, how is it possible to open a remotely stored .rdl file?
I also have a variable which has the rdl content stored in a string...not sure if this helps? So either I can use this string or pull the .rdl from the db...
I am a newbie to .NET so I am not sure how to best approach this...So far I have the following:
ReportViewer r = new ReportViewer();
//pass the rdl to report viewer
r.ProcessingMode = ProcessingMode.Remote;
You need to actually set it to Local processing mode not remote.
I've only ever loaded a RDL from a DLL not a database but I would look at the following API as it might have an overload to accept a string or you convert your string to a stream.
reportViewer.LocalReport.LoadReportDifinition
Here is the code I use to load from a DLL (might help to see in context)
Assembly assembly = Assembly.LoadFrom("MyReports.dll");
Stream stream = assembly.GetManifestResourceStream("Reports.MyReport.rdlc");
reportViewer.LocalReport.LoadReportDifinition(stream);
这篇关于打开远程RDL使用.NET报表查看器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!