这2天写个小程序,需要分割app.config里面的连接字符串
发现如果密码里面有双引号或者分号的时候,用string.split就不好用了
头疼了好一会.一google.发现ms已经帮你做好了.........
System.Data.Common.DbConnectionStringBuilder builder = new System.Data.Common.DbConnectionStringBuilder();
builder.ConnectionString = "Provider=\"Some;Provider\";Initial Catalog='Some;Catalog';";
foreach (string key in builder.Keys)
{
Response.Write(String.Format("{0}: {1}<br>", key , builder[key]));
}