简体   繁体   English

如何在C#WinForms中更改报表的路径

[英]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.

相关问题 如何更改 WinForms 中的 progressBar 以报告本机 C++ 代码的进度? - How to change progressBar in WinForms to report progress in native C++ code? 如何在c#中的rdlc报告中知道本地报告路径 - How to know local report path in rdlc report in c# 如何使用Crystal Report在C#Winforms中仅在运行时显示报告中的选定字段? - How to displays only selected fields from the report at runtime in c# winforms using crystal report? 如何在C#中更改SSRS报告的高度? - How to change the height of a SSRS report in C#? 如何更改Datagridview列分隔符颜色C#WinForms - How to change datagridview column divider color c# winforms c#如何从其他类更改/访问WinForms控件 - c# How to change/access WinForms controls from a different class 如何使用 C# WinForms 更改在 ComboBox 中查找字符串的方式 - How to change the way to find a string in ComboBox with C# WinForms C#winforms:如何更改System.Drawing.BItmap的DPI? - C# winforms: How to change DPI of the System.Drawing.BItmap? 如何在 TaskManager 中更改 C# WinForms exe 的图标 - How to change the icon of a C# WinForms exe, in TaskManager 如何在C#winforms中更改未使用的空格选项卡的背景颜色? - How to change the background color of unused space tab in C# winforms?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM