使用 vs2008 c#。 你好, 我有一个应用程序,我试图决定是否应该使用 Crystal 报表或 visual studio 安装附带的报表查看器。
我的问题是,虽然它在我的开发机器上运行良好,但许多将应用程序部署到远程位置的机器不会安装 Crystal Reports 或报表查看器的运行时。
因此,如果我使用其中任何一个构建应用程序,并阻止用户仅在没有运行时的机器上访问报告,应用程序是否可以正常运行,或者我应该预料到安装时会出现疯狂的错误等等
感谢任何建议。
最佳答案
您实际上可以通过部署项目或 ClickOnce 将 Crystal Reports 运行时包含在您的部署包中。在运行时,您可能会遇到错误,您可以像这样在 catch 语句或 application_threadexception 事件上处理这些错误:
private static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
{
//For missing crystal reports assembly
if ((e.Exception is System.IO.FileNotFoundException) && (e.Exception.Message.IndexOf("CrystalDecisions.CrystalReports.Engine") > -1))
MessageBox.Show("Crystal Reports is required to use this feature", "Crystal Reports", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
关于c# - Crystal Reports 和 Report Viewer 运行时问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2406197/