Exemplo n.º 1
0
        public bool CheckDatabaseInfo(clsIni ci, ref string ConnectionString, ref MySqlConnection myconn)
        {
            bool result = false;

            try
            {
                string myServerAddress = string.Empty;
                string myDataBase      = string.Empty;
                string myUsername      = string.Empty;
                string myPassword      = string.Empty;

                myServerAddress = ci.Read("Servername", "DatabaseSettings");
                myDataBase      = ci.Read("Databasename", "DatabaseSettings");
                myUsername      = ci.Read("Username", "DatabaseSettings");
                myPassword      = ci.Read("Password", "DatabaseSettings");

                if (!string.IsNullOrEmpty(myServerAddress) && !string.IsNullOrEmpty(myDataBase) &&
                    !string.IsNullOrEmpty(myUsername))
                {
                    ConnectionString = "Server = " + myServerAddress + "; Database = " + myDataBase + "; Uid = " + myUsername + "; Pwd =" + myPassword + ";";

                    result = cd.isDBConnected(ConnectionString, ref myconn);
                }
            }
            catch
            {
            }
            return(result);
        }
Exemplo n.º 2
0
 public string GetConnString()
 {
     clsIni ini = new clsIni(DBPath);
     string result = string.Empty;
     try
     {
         if (DBPath.Contains(".ini"))
         {
             result = "Server = " + ini.Read("ServerName", "DatabaseSettings") + "; Database = " + ini.Read("DatabaseName", "DatabaseSettings") + "; User Id = " + ini.Read("Username", "DatabaseSettings") + ";" +
                      "Password = "******"Password", "DatabaseSettings") + "; ";
         }
     }
     catch
     {
     }
     return result;
 }