构建设置后的工作报告

构建设置后的工作报告

本文介绍了构建设置后的工作报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何在c#中为不同的机器名称创建Crystal报表.


ReportDocument cryRpt =新的ReportDocument();
cryRpt.Load(@"C:\ Documents and Settings \ Arusha \ My Documents \ Visual Studio 2008 \ Projects \ Schooll工资系统\ Schooll工资系统\ rpt_empdataall.rpt");
crystalReportViewer1.ReportSource = cryRpt;
crystalReportViewer1.Refresh();



这里的阿鲁沙"是我的比赛名称,也是位置c的路径:在另一台机器上是不同的,因此在安装另一台机器后我无法获得报告.请给我解决方案.

i want to know how to create crystal report for different machine names in c#


ReportDocument cryRpt = new ReportDocument();
cryRpt.Load(@"C:\Documents and Settings\Arusha\My Documents\Visual Studio 2008\Projects\Schooll salary system\Schooll salary system\rpt_empdataall.rpt");
crystalReportViewer1.ReportSource = cryRpt;
crystalReportViewer1.Refresh();



here "Arusha" is my matchine name and also path of location c: is different for onother machine so i can''t genarate reports after intalling another machine. plz give me solution for this.

推荐答案


string myBasePath = System.IO.Path.GetDirectoryName(Application.ExecutablePath);


将此设为地面0,并找到与此路径相关的其他来源.
如果报告位于可执行文件旁边的名为"Reports"的目录中,则
您只能使用


Take this as ground 0 and find other sources relative to this path.
If a report is in a directory named "Reports" next to your executable then
you can just use

myBasePath+"\\Reports\\rpt_empdataall.rpt"

,因为报告位于可执行文件

in your case since report is located 2 level above executable

myBasePath+"\\..\\..\\rpt_empdataall.rpt"

的上方2级就足够了.
我希望这是您要实现的目标.

would suffice.
I hope that is what you are trying to achieve.


这篇关于构建设置后的工作报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-16 05:41