asp.net中Windows应用程序中的Crystal Reports [英] Crystal reports in windows application in asp.net

查看:74
本文介绍了asp.net中Windows应用程序中的Crystal Reports的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在使用Crystal报表创建Windows应用程序.要访问水晶报告,我们必须提供水晶报告的完整路径,如下所示.

Hi All,

I am creating windows application with crystal reports. To access the crystal report we have to give full path of the crystal report like below.

cryreport.Load("D:/AddressManagement/Reports/Village.rpt");
crystalReportViewer1.ReportSource = cryreport;
crystalReportViewer1.Refresh();



如果我们想将此项目提供给客户,我们还必须使用exe文件向客户提供报告.

因此,我为此应用程序创建了设置和部署项目",并将所有报告都放在了设置和部署项目"的应用程序"文件夹中.

所以我的问题是,将报告放入应用程序文件夹后,我必须在
中给出什么路径 cryreport.Load(.....);

请任何人都可以帮助我.我紧急需要它.



If we want to give this project to client we also have to give reports to client with exe file.

So i have created Set up and deployment project for this application and i have put all reports in the Application folder of Set up and deployment project.

So my question is that after putting reports in the application folder what path i have to give in
cryreport.Load(..........);

Please any one can help me in this. I need it in urgent.

Thanks and in regards in advance.

推荐答案

您可以将这些值用作获取实际安装设置的根目录,然后可以添加更多子目录用它们中的任何一个来查找包含.rpt文件的文件夹(与安装项目中使用的文件夹相同).

对于asp.net应用程序:

HttpContext.Current.Request.ApplicationPath;

对于使用VB.Net的Windows App:

AppDomain.CurrentDomain.BaseDirectory
These values you can use as to get the root location where the setup in actually being installed and then further sub directories can be added with any of them to locate the folder (same as used in setup project) which contains the .rpt files.

For asp.net application:

HttpContext.Current.Request.ApplicationPath;

For Windows App using VB.Net:

AppDomain.CurrentDomain.BaseDirectory


有关详细信息,请参见下面的链接

Look at below link for details

msdn.microsoft.com/en-us/magazine/cc301570.aspx


感谢您的所有帮助.

终于我找到了解决办法

C#
Application.StartupPath +"\\" +"MyReport.rpt";

VB
应用程序.启动路径"\"& "MyReport.rpt";

如果您仍然发现问题,请回复我.
Thanks for all your help.

Finally I got the solution

C#
Application.StartupPath + "\\" + "MyReport.rpt";

VB
Application.StartupPath & "\" & "MyReport.rpt";

Revert back to me if you still find problem.


这篇关于asp.net中Windows应用程序中的Crystal Reports的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆