需要C#Windows应用程序帮助 [英] C# Windows Application help required

查看:83
本文介绍了需要C#Windows应用程序帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作Windows应用程序,我在app.config中有这样的连接字符串

I am making a windows application,I have connection string in app.config like this

<add name="Assignement1_2008.Properties.Settings.SummonsSoundsv1ConnectionString"
            connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\abc.accdb"
            providerName="System.Data.OleDb" />



数据库abc位于我的项目(即根目录)的解决方案中

我想使用位于Debug文件夹中的数据库

如何更改App.config的连接字符串?



The DB abc is located in solution of my project(ie root directory)

I want to use the DB which is located inside Debug folder

How can I Change the connection string of App.config??

推荐答案

您可以使用以下命令:

You can use this:

<add name="Assignement1_2008.Properties.Settings.SummonsSoundsv1ConnectionString"
            connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=.\\abc.accdb"
            providerName="System.Data.OleDb" />



希望能有所帮助:)



Hope this help :)



有一个专门用于连接字符串设置的完整资源.
可以找到:此处 [
Hi,
there is an entire resource specifically available for connection strings settings.
It can be found: here[^]. There are plenty of examples how you can attach a database to the application, by pointing to a specific file rather than server path.
Regards


直接使用而不是DataDirectory.

Use directly instead of DataDirectory.

<add name="Assignement1_2008.Properties.Settings.SummonsSoundsv1ConnectionString"
            connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=.\\abc.accdb"
            providerName="System.Data.OleDb" />



这将解决您的问题.



This will solve your problem.


这篇关于需要C#Windows应用程序帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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