private void CheckDatabaseConnection()
 {
     if (!cv.TestDatabaseConnection(tbServerName.Text, tbDatabasename.Text, tbDBUsername.Text, tbDBPassword.Text))
     {
         MessageBox.Show("Error: Cannot connecto to database. Please check your settings.", "Failed to connect", MessageBoxButtons.OK, MessageBoxIcon.Error);
         lblDBStatus.Text      = "DISCONNECTED";
         lblDBStatus.ForeColor = Color.Red;
         pbDatabaseImage.Image = Image.FromFile(Environment.CurrentDirectory + "\\Resources\\dbnotconnect.jpg");
         return;
     }
     else
     {
         lblDBStatus.Text      = "CONNECTED";
         lblDBStatus.ForeColor = Color.Black;
         pbDatabaseImage.Image = Image.FromFile(Environment.CurrentDirectory + "\\Resources\\dbconnect.jpg");
     }
 }
Exemple #2
0
 private void CheckDatabaseConnection()
 {
     tmrLoading.Stop();
     GetDBSettings();
     if (!cv.TestDatabaseConnection(Servername, Databasename, DBUsername, DBPassword))
     {
         tmrLoading.Enabled = false;
         tmrLoading.Stop();
         tmrLoading.Dispose();
         lblSys.Text      = "Error: Database cannot connect. Please check configuration first";
         lblSys.ForeColor = Color.Red;
         MessageBox.Show(lblSys.Text, "Failed to connect", MessageBoxButtons.OK, MessageBoxIcon.Error);
         counterLogin       = 0;
         progressBar1.Value = counterLogin;
         return;
     }
     tmrLoading.Start();
 }