Exemplo n.º 1
0
 public bool connect(Server server)
 {
     try
     {
         string strCon = "server=" + server.Hostname + ";User Id=" + server.Username + ";Password="******";Persist Security Info=True;database=" +  server.Database;
         con = new MySqlConnection(strCon);
         con.Open();
         con.Close();
         return true;
     }
     catch (MySqlException)
     {
         return false;
     }
 }
Exemplo n.º 2
0
 private void radButton_ok_Click(object sender, EventArgs e)
 {
     Server server = new Server();
     server.Hostname = radTextBox_hostname.Text;
     server.Username = radTextBox_username.Text;
     server.Password = radTextBox_password.Text;
     server.Database = radTextBox_database.Text;
     if (util.connect(server))
     {
         ArrayList arrServer = new ArrayList();
         arrServer.Add(server);
         util.saveList(arrServer, "server.list");
         if (frmMain == null || frmMain.IsDisposed)
         {
             frmMain = new MainForm();
             frmMain.frmSetup = this;
             frmMain.Show();
             frmMain.Activate();
         }
     }
 }