//open connection to database public bool OpenConnection() { try { connection.Open(); return(true); } catch (MySqlException ex) { //When handling errors, you can your application's response based //on the error number. //The two most common error numbers when connecting are as follows: //0: Cannot connect to server. //1045: Invalid user name and/or password. switch (ex.Number) { case 0: string msg = MultiLanguage.GeErrorConnectionString(); MessageBox.Show(msg); break; case 1045: string msg1 = MultiLanguage.GeErrorLoginString(); MessageBox.Show(msg1); break; } return(false); } }