Example #1
0
        //test connection for server
        public static bool TestConnection()
        {
            try
            {
                //set database connection
                using (MySqlConnection con = new MySqlConnection(GOC_Tabulation_System.Config.GetConnectionString()))
                {
                    //open connection
                    con.Open();

                    return(true);
                }
            }
            catch (MySqlException ex)
            {
                //revert settings
                Properties.Settings.Default.HOST     = String.Empty;
                Properties.Settings.Default.DATABASE = String.Empty;
                Properties.Settings.Default.USERNAME = String.Empty;
                Properties.Settings.Default.PASSWORD = String.Empty;
                Properties.Settings.Default.DSN      = String.Empty;

                //save settings
                Properties.Settings.Default.Save();

                //error configuration
                MessageBox.Show("Error: Cannot connect to server" + ex.Message.ToString(), "System Message", MessageBoxButtons.OK, MessageBoxIcon.Error);

                frmSetting set = new frmSetting();
                set.ShowDialog();
                return(false);
            }
        }
Example #2
0
        private void button3_Click(object sender, EventArgs e)
        {
            frmSetting frm = new frmSetting();

            frm.ShowDialog();
        }
Example #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            frmSetting set = new frmSetting();

            set.ShowDialog();
        }