Example #1
0
        private void describeMenu_Click(object sender, EventArgs e)
        {
            ssh.Connect();
            DescribeOutput descOutput = ssh.Describe(listBox1.SelectedItem.ToString());

            DataTable dtDescribe = new DataTable();

            dtDescribe.Columns.Add("Name");
            dtDescribe.Columns.Add("Type");
            dtDescribe.Columns.Add("Modifiers");
            dtDescribe.Columns.Add("Primary Key");
            foreach (DBColumn column in descOutput.Columns)
            {
                DataRow r = dtDescribe.NewRow();
                r["Name"]        = column.ColumnName;
                r["Type"]        = column.Type;
                r["Modifiers"]   = column.Modifiers;
                r["Primary Key"] = column.IsPrimaryKey ? "X" : "";
                dtDescribe.Rows.Add(r);
            }
            describeTable.DataSource = dtDescribe;



            ssh.Disconnect();
        }
Example #2
0
        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);
            }
        }
Example #3
0
        private void btnExecute_Click(object sender, EventArgs e)
        {
            ssh.Connect();
            DBModifyOutput output = ssh.ExecuteScript(txtScript.Text);

            txtOuput.ForeColor = output.Status == 0 ? Color.Green : Color.Red;
            txtOuput.Text      = output.Response;
            ssh.Disconnect();
        }
Example #4
0
        private void QuerySelect()
        {
            DataTable sqlresponse = new DataTable();


            ssh.Connect();
            SelectOutput selectOutput = ssh.SelectFromTable(Table, txtWhere.Text, txtOrder.Text, txtLimit.Text);


            dataGridView1.DataSource = selectOutput.Table;
            PrimaryKeyData           = selectOutput.PrimaryKey;
            ssh.Disconnect();

            UpdateList.Clear();
            InsertList.Clear();

            InitialRowsCount = dataGridView1.Rows.Count;
        }
Example #5
0
        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();
        }