将密码添加到app config连接字符串 [英] Add password to app config connection string

查看:102
本文介绍了将密码添加到app config连接字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的连接字符串中添加一个密码,打开我的密码保护的Access文件。



我之前在Form1.cs中做过这个但是无法用XML计算



我有一个密码对话框,用户输入密码但是要打开访问文件

,因为它有一个密码





I want to add a password to my connection string that opens my Access file which is password protected.

I have done this before in the Form1.cs but cant figure it out in XML

I have a password dialog the user enters a password but it want open the access file
because it has a password on it


<pre><?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <configSections>
    </configSections>
    <connectionStrings>
        <add name="Employee_List.Properties.Settings.Database5ConnectionString"
            connectionString= "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\Database5.accdb"
            providerName="System.Data.OleDb" />
    
    </connectionStrings>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
    </startup>
</configuration>










private void Form1_Load_1(object sender, EventArgs e)
{

    // TODO: This line of code loads data into the 'database5DataSet.Employee' table. You can move, or remove it, as needed.
    this.employeeTableAdapter.Fill(this.database5DataSet.Employee);

}





我的尝试:



搜索Appconfig和连接字符串



What I have tried:

Searching Appconfig and connection strings

推荐答案

我知道回答有点迟,但我会看看这个,有一个名为的部分,带有数据库密码



访问连接字符串 - ConnectionStrings.com [ ^ ]
I know this is a bit late to give an answer but I would have a look at this, there is a section in the called With database password

Access connection strings - ConnectionStrings.com[^]


这篇关于将密码添加到app config连接字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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