[英]How to Change path to a report in c# winforms
I work on two computers(database,forms,reports) and I added report but when I move the Project to the other computer and I try to activate the reports it shows an error. 我在两台计算机(数据库,表单,报告)上工作,并添加了报告,但是当我将项目移至另一台计算机上并尝试激活报告时,它显示了错误。 The error says that the path to the report wasn't found and it shows me the path of the computer I created the reports.
该错误表明找不到报告的路径,它向我显示了创建报告的计算机的路径。 when I click on a report I see in the properties the path of the computer I'm using so I guess there is an other path to the reports and I need to change it.
当我单击报告时,我会在属性中看到我正在使用的计算机的路径,因此我猜想报告还有其他路径,因此我需要对其进行更改。 what to do?
该怎么办?
edit: the name of the reportWizard is Citys.rdlc
and the name of the form which I show the report is CityReport.cs
编辑:
Citys.rdlc
的名称是Citys.rdlc
,我显示该报表的表单的名称是CityReport.cs
In the properties window of the report under Misk/FullPath:C:\\Users\\computer1\\Desktop\\New folder\\Work\\Work\\Reports\\Citys.rdlc
在报表的属性窗口中的
Misk/FullPath:C:\\Users\\computer1\\Desktop\\New folder\\Work\\Work\\Reports\\Citys.rdlc
The error when I try to open the report : 当我尝试打开报告时出现错误:
An error occurred during local report proccessing.
本地报告处理期间发生错误。 The report definition for report 'C:\\Users\\Computer2\\Desktop\\work\\work\\Reports\\Citys.rdlc'.
报告'C:\\ Users \\ Computer2 \\ Desktop \\ work \\ work \\ Reports \\ Citys.rdlc'的报告定义。 Could not find a part of the path 'C:\\Users\\Computer2\\Desktop\\work\\work\\Reports\\Citys.rdlc'.
找不到路径“ C:\\ Users \\ Computer2 \\ Desktop \\ work \\ work \\ Reports \\ Citys.rdlc”的一部分。
what you can do is add a Application configuration file to your project and specify the path
in that file and slightly change your code to access the path from this file. 您可以做的是将一个Application配置文件添加到您的项目中,并在该文件中指定
path
,然后稍微更改代码以访问该文件中的路径。 just google using App.config in c#
you will find enough information. 只是谷歌
using App.config in c#
您将找到足够的信息。
once that is done just change the path, when running on different computer, in the app.config file and use it on any computer you want 一旦完成,只需在app.config文件中的其他计算机上运行时更改路径,然后在所需的任何计算机上使用
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.