SqlConnectionStringBuilder

正用:
System.Data.SqlClient.SqlConnectionStringBuilder builder =
  new System.Data.SqlClient.SqlConnectionStringBuilder();
builder["Data Source"] = "(local)";
builder["integrated Security"] = true;
builder["Initial Catalog"] = "AdventureWorks;NewValue=Bad";
Console.WriteLine(builder.ConnectionString);

反用:

DbConnectionStringBuilder builder = new DbConnectionStringBuilder();
builder.ConnectionString = strConnectionString;
Console.WriteLine(builder["Password"].ToString());

 

posted on 2011-10-11 23:37  一路前行  阅读(2253)  评论(0编辑  收藏  举报