Crystal报告加载路径 [英] Crystal report load path

查看:95
本文介绍了Crystal报告加载路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用ms vsstudio 2010(c#)..



我在项目中名为report的文件夹。它包含我项目的所有水晶报告(5个报告文件)。所以,如果我想将我的项目转移到其他PC,我也会改变路径,我是对的吗?!



i想要转移我的项目文件夹而不改变所有水晶报告的路径。



是另一个博士减轻这个问题的方法?我在想我是否只能调用文件夹名称和文件名。例如,rpt.Load(foldername\cor.rpt)..如何做到这一点? TIA。



#newbie



我的尝试:



using ms vsstudio 2010 (c#)..

i hv a folder named "report" in project. it contains all the crystal reports (5 report files) of my project. so if i want to transfer my project into other PC, i will also change the path, am i right?!

i want to transfer my project folder without changing the path of all crystal reports.

is dr another way to lessen this problem?. i was thinking if i can call only call the folder name and the file name. for example, rpt.Load("foldername\cor.rpt").. how to do this? TIA.

#newbie

What I have tried:

rpt.Load(@"C:\Users\machuca\documents\visual studio 2010\Projects\enrollment\enrollment\reports\rptcor.rpt");

推荐答案

如果您正在制作Windows窗体应用程序,则有2种方法;

a)使用始终可访问的网络共享 - 您也可以使用固定位置,例如 c:\ Report>

b)移动报告文件夹到可执行文件所在的文件夹然后使用;

If you are making a Windows Forms application there is 2 methods;
a) Use a network share that will always be accessible - you could alternatively use a fixed location such as c:\Reports
b)Move your reports folder to the folder where the executable is and then use either;
rpt.Load(System.Windows.Forms.Application.StartupPath + "\\Reports\\ReportName.rpt");






or

rpt.Load(System.AppDomain.BaseDirectory + "\\Reports\\ReportName.rpt");





如果您正在制作ASP.Net应用程序,那么您会在您的网站中创建一个Reports文件夹(通常作为您网站根目录中的子文件夹),然后使用



If you are making a ASP.Net application then you would create a Reports folder within your website (typically as a sub folder in the root of your web site) and then load the report using

rpt.Load(Server.MapPath(@"~/Reports/ReportName.rpt"));

< br $>


亲切的问候



Kind Regards


这篇关于Crystal报告加载路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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