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);
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());
builder.ConnectionString = strConnectionString;
Console.WriteLine(builder["Password"].ToString());