using System;
using System.Configuration;
namespace DBUtility
{
public class PubConstant
{
///
/// 獲取連接字符串
///
public static string ConnectionString
{
get
{
string _connectionString = ConfigurationManager.AppSettings["ConnectionString"];
string ConStringEncrypt = ConfigurationManager.AppSettings["ConStringEncrypt"];
if (ConStringEncrypt == "true")
{
_connectionString = DESEncrypt.Decrypt(_connectionString);
}
return _connectionString;
}
}
///
/// 得到web.config裏配置項的資料庫連接字符串
///
///
///
public static string GetConnectionString(string configName)
{
string connectionString = ConfigurationManager.AppSettings[configName];
string ConStringEncrypt = ConfigurationManager.AppSettings["ConStringEncrypt"];
if (ConStringEncrypt == "true")
{
connectionString = DESEncrypt.Decrypt(connectionString);
}
return connectionString;
}
}
}