Loading Crystal Report from embedded resource
I have an ASP.NET website and a referenced class library project. In t开发者_运维知识库his class library I have a Crystal Report set as embedded resource. I want to load the report dynamically into a CrystalReportViewer.
How do I do it?
I figured out how to solve that problem. When a Crystal Report is added to a Class Library project, it creates a corresponding class, which inherits from ReportClass. An instance of this class can be used as ReportSource of the viewer.
Example:
var report = new CrystalReport1();
report.SetDataSource(datasource);
CrystalReportViewer1.ReportSource = report;
精彩评论