mikebai.com

  • Home
  • dev
  • DotNET
  • M365
  • 搞笑
  • 杂七杂八
  • FocusDict
個人BLOG
it developer
  1. Main page
  2. DotNET
  3. Main content

ConnectionString连接字符串分割

2010-09-28 92hotness 0likes 0comments

这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])); 
       
} 

Tag: Nothing
Last updated:2010-09-28

mikebai

This person is a lazy dog and has left nothing

Like
< Last article
Next article >

COPYRIGHT © 2025 mikebai.com. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang