private void RemoteConnection(Config nConfig) { this.ssh = new SshDbWrapper(nConfig.SSH_HOST, nConfig.SSH_USER, nConfig.SSH_PASSW, nConfig.DB_HOST, nConfig.DB_PORT, nConfig.DB_USER, nConfig.DB_SCHEMA, nConfig.DB_PASSWORD); ssh.Connect(); List <String> tableList = ssh.TableList(); ssh.Disconnect(); //assign a contextmenustrip listboxContextMenu = new ContextMenuStrip(); listboxContextMenu.Opening += new CancelEventHandler(listboxContextMenu_Opening); listBox1.ContextMenuStrip = listboxContextMenu; listBox1.Items.Clear(); foreach (String table in tableList) { listBox1.Items.Add(table); } }
private void btnDdlCompare_Click(object sender, EventArgs e) { Config source = ConfigList[(String)ddlListConnection1.SelectedItem]; Config destination = ConfigList[(String)ddlListConnection2.SelectedItem]; SourceConnection = new SshDbWrapper(source.SSH_HOST, source.SSH_USER, source.SSH_PASSW, source.DB_HOST, source.DB_PORT, source.DB_USER, source.DB_SCHEMA, source.DB_PASSWORD); DestinationConnection = new SshDbWrapper(destination.SSH_HOST, destination.SSH_USER, destination.SSH_PASSW, destination.DB_HOST, destination.DB_PORT, destination.DB_USER, destination.DB_SCHEMA, destination.DB_PASSWORD); SourceConnection.Connect(); DestinationConnection.Connect(); lstBox1.Items.Clear(); foreach (String table in SourceConnection.TableList()) { lstBox1.Items.Add(table); } lstBox2.Items.Clear(); foreach (String table in DestinationConnection.TableList()) { lstBox2.Items.Add(table); } SourceConnection.Disconnect(); DestinationConnection.Disconnect(); }