我应该如何为我的水晶报告制作一条路径? [英] How should I make a path for my crystal reports?
本文介绍了我应该如何为我的水晶报告制作一条路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望至少有一种更好的方法可以通过不使用长文件路径在我的c#窗体中加载我的水晶报告。
什么我试过了:
所以我尝试实现长文件路径:
I want to have at least a better way to load my crystal report in my c# windows form by not using a long file path.
What I have tried:
So I tried implementing the long file path which is:
inv.Load(@"C:\Users\jonat\onedrive\documents\visual studio 2015\Projects\FunctionApp\FunctionApp\InventoryReport.rpt");
我也试过这个:
I also tried this:
inv.Load(Path.GetDirectoryName("InventoryReport.rpt"));
另外这一个:
Also this one:
inv.Load(Application.StartupPath + "InventoryReport.rpt");
这两个都没有工作,我也试过文件路径(〜\\)bu t也没用?
None of the two worked, I also tried the file path with ("~\\") but also didn't worked
推荐答案
Winforms桌面:
Winforms Desktop :
report2.Load(@"" + Application.StartupPath + @"\Reports\Driver_Kart.rpt");
网页表格:
Web Forms:
report2.Load(Server.MapPath(@"~\Reports\ProjectReport.rpt"));
这篇关于我应该如何为我的水晶报告制作一条路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文