简体   繁体   English

Visual Studio 2008中的Crystal Reports

[英]Crystal Reports in Visual Studio 2008

I have embedded some crystal reports in my C# application. 我在C#应用程序中嵌入了一些水晶报表。 The problem is, compiling the project creates dlls for the reports also, which means in future any change in report will need re-installation of the application. 问题是,编译项目也会为报告创建dll,这意味着将来对报告的任何更改都需要重新安装应用程序。 Is there any way that I can keep them as .rpt files and they can be changed any time by just copying the .rpt file into application folder?? 有什么方法可以将它们保存为.rpt文件,并且可以通过将.rpt文件复制到应用程序文件夹中随时进行更改?

Thanks :) 谢谢 :)

You can use ReportDocument.Load method. 您可以使用ReportDocument.Load方法。

ReportDocument reportDocument = new ReportDocument();
reportDocument.Load(reportName, OpenReportMethod.OpenReportByTempCopy);
crystalReportViewer.ReportSource = reportDocument;

Yes, in one of my applications I set the "Copy To Output Directory" property of the report to "Copy Always" and the "Build Action" as "Content" so that the report is copied down as content when it is deployed. 是的,在我的一个应用程序中,我将报表的“复制到输出目录”属性设置为“始终复制”,并将“构建操作”设置为“内容”,以便在部署报表时将其作为内容复制下来。

Then when you load the report you can set the connection information and parameters at runtime. 然后,当您加载报告时,可以在运行时设置连接信息和参数。

I currently do this for a ClickOnce application for a client. 我目前正在为客户端的ClickOnce应用程序执行此操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM