Пример #1
0
        static void OpenConnection()
        {
            string settingsFile = IO.workingDirectory + @"/gsettings.ini";
            string Host         = IO.readINI("Database", "host", settingsFile);
            int    Port         = Convert.ToInt32(IO.readINI("Database", "port", settingsFile));
            string Username     = IO.readINI("Database", "username", settingsFile);
            string Password     = IO.readINI("Database", "password", settingsFile);
            string Database     = IO.readINI("Database", "database", settingsFile);

            if (DB.openConnection(Host, Port, Database, Username, Password) == false)
            {
                DialogResult dialogResult = MessageBox.Show("Do You Want To Re-Try?", "Can't Connect to MySQL DataBase", MessageBoxButtons.YesNo);
                if (dialogResult == DialogResult.Yes)
                {
                    OpenConnection();
                }
                else if (dialogResult == DialogResult.No)
                {
                    MessageBox.Show("The Application will be close!", "Can't Connect to MySQL DataBase'", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Environment.Exit(0);
                }
            }
            MYSQL.openConnection(Host, Port, Database, Username, Password, 100);
        }