private void btnConnect_Click(object sender, EventArgs e) { if (ValidateInput()) { Config.Host = tbHost.Text; Config.Port = tbPort.Text; Config.SuperUserId = tbUser.Text; Config.SuperPassword = tbPassword.Text; ToolConfig.Host = tbHost.Text; ToolConfig.Port = tbPort.Text; ToolConfig.SuperUserId = tbUser.Text; ToolConfig.SuperPassword = tbPassword.Text; string superConnString = Config.GetSuperConnectionString();// GetConnectionString(); NpgsqlConnection connection = new NpgsqlConnection(superConnString); try { connection.Open(); frmSricptRunner sqlRun = new frmSricptRunner(); //sqlRun.Host = tbHost.Text; //sqlRun.Port = tbPort.Text; //sqlRun.UserId = tbUser.Text; //sqlRun.Password = tbPassword.Text; //sqlRun.SuperConnString = superConnString; connection.Close(); this.Hide(); sqlRun.Show(); } catch (Exception ex) { MessageBox.Show("Error connecting to database:" + ex.Message); } } }
private void btnInstallInCloud_Click(object sender, EventArgs e) { string host = "37.34.53.43"; string port = "5432"; string userId = "postgres"; string password = "******"; string connString = string.Format("SERVER={0};Port={1};User id={2};Password={3};encoding=unicode", host, port, userId, password); NpgsqlConnection connection = new NpgsqlConnection(connString); try { connection.Open(); frmSricptRunner sqlRun = new frmSricptRunner(); //sqlRun.Host = host; //sqlRun.Port = port; //sqlRun.UserId = userId; //sqlRun.Password = password; //sqlRun.SuperConnString = connString; Config.Host = host; Config.Port = port; Config.SuperUserId = userId; Config.SuperPassword = password; connection.Close(); this.Hide(); sqlRun.Show(); } catch (Exception ex) { MessageBox.Show("Error connecting to database:" + ex.Message); } }