예제 #1
0
        public static string GenConnectionString()
        {
            SqlConnectionStringBuilder connectionStringBuilder = new SqlConnectionStringBuilder();

            connectionStringBuilder.IntegratedSecurity = false;
            connectionStringBuilder.DataSource         = DataSource;
            connectionStringBuilder.InitialCatalog     = InitialCatalog;
            if (string.IsNullOrEmpty(UserIDWithDES))
            {
                connectionStringBuilder.UserID = UserID;
            }
            else
            {
                connectionStringBuilder.UserID = My.DecryptByDES(UserIDWithDES);
            }
            if (string.IsNullOrEmpty(PasswordWithDES))
            {
                connectionStringBuilder.Password = Password;
            }
            else
            {
                connectionStringBuilder.Password = My.DecryptByDES(PasswordWithDES);
            }
            connectionStringBuilder.ConnectTimeout = ConnectTimeout > 0 ? ConnectTimeout : 30; //Sec(default 15)
            connectionStringBuilder.Pooling        = true;
            connectionStringBuilder.MaxPoolSize    = MaxPoolSize > 0 ? MaxPoolSize : 100;
            connectionStringBuilder.MinPoolSize    = MinPoolSize > 0 ? MinPoolSize : 0;

            return(connectionStringBuilder.ConnectionString);
        }