• (转)使用 ConnectionStringBuilder 对象创建精确连接字符串


    DBConnectionStringBuilder 对象能够验证所有可用的连接字符串设置.
    
    它可以启动高级连接选项,如连接池,群集连接和异步访问.
    
    DBConnectionStringBuilder 创建与数据库平台无关的代码过程中扮演一个重要角色.
    
    它派生出 SqlConnectionStringBuilder、OracleConnectionStringBuilder、OdbcConnectionStringBuilder 和 
    OleDbConnectionStringBuilder ,利用面向对象的特性可以容易的创建与平台无关的数据库应用程序.
    
    用法:
    
    C#
    
                SqlConnectionStringBuilder connbuilder = new SqlConnectionStringBuilder();
                 connbuilder.DataSource = "localhost";
                 connbuilder.UserID = "user";
                 connbuilder.Password = "password";
                 connbuilder.MinPoolSize = 5;
                 connbuilder.MaxPoolSize= 20;
                 SqlConnection conn = new SqlConnection(connbuilder.ConnectionString);
                 conn.Open();
                DbConnectionStringBuilder builder = new DbConnectionStringBuilder();
                builder.ConnectionString = accountSet.DBSetting.ConnectionString;
    
                object dataSource = null;
                if (builder.TryGetValue(Const.DATASOURCE, out dataSource))
                {
                    serverModel.DBIP = dataSource.ToString().Trim();
                }

    原文地址:http://www.cnblogs.com/waylee/archive/2008/10/22/1316571.html

  • 相关阅读:
    点分治
    SG函数入门
    博弈论入门
    YY的gcd
    整除分块
    gcd约分函数的应用
    C++ 模拟类型(提高)
    C++数论题(博弈论)
    C++(gcd)的应用2。
    C++暴力约分(gcd).
  • 原文地址:https://www.cnblogs.com/jackping/p/3067321.html
Copyright © 2020-2023  润新知