修改强类型化数据集连接字符串的数据源 [英] Modifying the Data Source for the Strongly Typed Dataset connection string

查看:179
本文介绍了修改强类型化数据集连接字符串的数据源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是与修改强类型数据集连接字符串的数据源相关的两个问题。

Here are two questions related to modifying the data source for strongly typed dataset connection string.

部署应用程序时,轻量级数据库Microsoft Access)部署到应用程序数据文件夹。我有一个强类型的数据集,它包裹了。所以问题是如何更改以下app.config代码:

When my app is deployed, a light weight database ( in the form of Microsoft Access) is deployed to the Application Data folder. I have a strongly typed dataset that is wrapped around that. So the question is how to change the following app.config code:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <configSections>
    </configSections>
    <connectionStrings>
        <add name="XTrace.Properties.Settings.Timer_DBConnectionString"
            connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=&quot;|DataDirectory|\Timer DB.mdb&quot;;Persist Security Info=True"
            providerName="System.Data.OleDb" />
    </connectionStrings>
</configuration>

要从Application Data文件夹副本中读取吗?

To make it read from the Application Data folder copy?

阅读SO 和其他地方,最好使用app.config或web.config来管理连接字符串。但是由于app.config被编译到Windows窗体中,它如何提供灵活性,允许在部署时更改连接字符串?我不是在谈论web应用程序虽然,因为我明白,web应用程序分发web.config和从该文件可以修改你的连接字符串。

I read from SO and elsewhere that it's best to use app.config or web.config to manage the connection string. But since the app.config is compiled into the Windows Form, how does it suppose to provide the flexibility that allows one to change the connection string at deployment time? I am not talking about web app though, because I understand that it's possible that web app distributes the web.config and from that file you can modify your connection string.

推荐答案

部署Windows窗体应用程序时,可以有一个app.config文件。

When you deploy an Windows Forms application you could have an app.config file.

yourproject.exe提供了一个yourproject.exe.config文件,它是app.config文件。

yourproject.exe gives you a yourproject.exe.config file, which is the app.config file.

这篇关于修改强类型化数据集连接字符串的数据源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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