Crystal 2008中的服务器端报告?
-
05-07-2019 - |
题
我希望将Crystal Reports 2008集成到Windows窗体应用程序中。我想避免从我的客户端应用程序直接连接到数据库,同时向用户提供“完整”的信息。报告经验。 Crystal Reports 2008是否可以将服务器上的报表执行到客户端Windows窗体客户端控件,类似于Microsoft Reporting Services?
解决方案
我不知道它是否正是你所追求的,但我可以想到两种方法可以捏造它:
- 您可以设置报告,以便“数据库”是XSD文件,而不了解真正的后端。然后在运行时将数据推送到报告中。 醇>
//在运行时创建适合您环境的实例 - 仅限示例:
ReportClass rc = new ReportClass();
rc.Load(crystalReportFileName);
rc.SetDataSource(myIEnumerableData);
CrystalReportViewer crv = new CrystalReportViewer();
crv.ReportSource = rc;
//显示水晶查看器。
2 - 您可以在服务器上执行与1相同的操作(无论数据库方法如何),然后保存报告并将其推送到客户端。
//某些服务器端服务/方法等
public byte [] GetMyReport() {
ReportClass rc = new ReportClass();
rc.Load(crystalReportFileName);
rc.SetDataSource(myIEnumerableData);
rc.SaveAs(serverSideFile,True); // True对于使用报告保存数据至关重要
return .... //将创建的文件转换为我猜想的字节数组
}
//客户端
byte [] rep = Server。 GetMyReport()
ReportClass rc = ..... //将rep转换回水晶报告
CrystalReportViewer crv = new CrystalReportViewer();
crv.ReportSource = rc;
其他提示
这不是您要求的,但Crystal Reports Server会执行服务器端报告。
在不利方面,这是非常昂贵的。
http://www.businessobjects.com/product/catalog/crystalreports_server/一>
我无法在上面添加评论,因为我没有积分,但希望这有帮助。
Crystal Reports Server根据数据源运行报告,其想法是没有水晶报告或数据访问的客户端可以通过Web运行报告,或者服务器运行预定报告并将结果发送出去。我不知道你是否可以整合它。