Ejemplo n.º 1
0
 protected CommConnection getSQLConnection(DataBases DBName, String ServerIP, String Account, String Password)
 {
     try
     {
         BaseConnection BConn = new BaseConnection();
         if (ServerIP != null)
         {
             BConn.Server   = ServerIP;
             BConn.Account  = Account;
             BConn.Password = Password;
         }
         else
         {
             BConn.Path = Server.MapPath(Url.Content("~"));
         }
         return(BConn.GetConnection(DBName));
     }
     catch (Exception ex)
     {
         Log.Write(new Log.LogPlamInfo()
         {
         }, this.GetType().Name, System.Reflection.MethodInfo.GetCurrentMethod().Name, ex);
         return(null);
     }
 }
Ejemplo n.º 2
0
 protected CommConnection getSQLConnection()
 {
     BaseConnection BConn = new BaseConnection();
     String DataConnectionCode = System.Configuration.ConfigurationManager.AppSettings["DB00"];
     String[] DataConnectionInfo = DataConnectionCode.Split(',');
     BConn.Server = DataConnectionInfo[0];
     BConn.Account = DataConnectionInfo[1];
     BConn.Password = DataConnectionInfo[2];
     return BConn.GetConnection();
 }
Ejemplo n.º 3
0
        protected CommConnection getSQLConnection()
        {
            BaseConnection BConn = new BaseConnection();
            String         DataConnectionCode = System.Configuration.ConfigurationManager.AppSettings["DB00"];

            String[] DataConnectionInfo = DataConnectionCode.Split(',');
            BConn.Server   = String.IsNullOrWhiteSpace(DataConnectionInfo[0]) ? c.Server.MapPath("~") : DataConnectionInfo[0];
            BConn.Account  = DataConnectionInfo[1];
            BConn.Password = DataConnectionInfo[2];
            return(BConn.GetConnection());
        }
Ejemplo n.º 4
0
        protected CommConnection getSQLConnection(DataBases DBName)
        {
            //預設的資料庫
            String DataBasesCodeName  = DBName.ToString();
            String DataConnectionCode = System.Configuration.ConfigurationManager.AppSettings[DataBasesCodeName.Substring(0, 4)];

            String[] DataConnectionInfo = DataConnectionCode.Split(',');
            //直接採用預設的資料庫
            BaseConnection BConn = new BaseConnection();

            //SQL Server & MySql 採用
            BConn.Server   = DataConnectionInfo[0];
            BConn.Account  = DataConnectionInfo[1];
            BConn.Password = DataConnectionInfo[2];
            BConn.Path     = Server.MapPath("~");

            return(BConn.GetConnection(DBName));
        }