要从我的App.config获取连接字符串,我编写以下代码:
ConnectionStringSettings settings
= ConfigurationManager.ConnectionStrings["livresEntities"];
string connectString = settings.ConnectionString;
Console.WriteLine("Original: "+ connectString);
结果(我使用Data Model .edmx文件):
原文:metadata = res://*/Model1.csdl | res://*/Model1.ssdl | res://*/Model1.msl; provider = MySql.Data.MySqlClient; provider connection string =& #34; server = localhost; user id = root; persistsecurityinfo = True; database = livres"
但是当我想使用这一行更改密码或uid时:
MySqlConnectionStringBuilder builder
= new MySqlConnectionStringBuilder(connectString);<br>
它给我以下错误:
不支持关键字
为什么呢?如果有关于如何使用模型(.edmx)保护MySQL连接字符串的任何教程,对我来说将非常有帮助。