private void editConnectionToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (this.provider != null)
            {
                IDatabaseProvider provider = DatabaseConnectionDialog.Show(this, this.provider.Identifier, this.provider.ConnectionString);
                if (provider != null)
                {
                    provider.Open();
                    this.provider = provider;

                    // Reset list connections:
                    this.SchemasList.Items.Clear();
                    this.TablesList.Items.Clear();
                    foreach (DbSchema item in this.provider.GetSchemas())
                    {
                        ListViewItem lvi = SchemasList.Items.Add(item.ToString(), 1);
                        lvi.Tag   = item;
                        lvi.Group = SchemasList.Groups["Schemas"];
                    }
                    this.SchemasList.Columns[0].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);

                    // Refresh window state and title:
                    this.UpdateWindowState();
                }
            }
        }
Exemple #2
0
        public static new IDatabaseProvider Show(IWin32Window owner)
        {
            DatabaseConnectionDialog dlg = new DatabaseConnectionDialog();

            dlg.ShowDialog(owner);
            return(dlg.Result);
        }
        private void newSessionToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // Open new connection:
            if (this.CloseSession(true))
            {
                this.provider = DatabaseConnectionDialog.Show(this);

                NewSession();
            }
        }
        private void TryOpenConnection()
        {
            bool succeeded = false;

            while ((this.provider != null) && (!succeeded))
            {
                try
                {
                    this.provider.Open();
                    succeeded = true;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(this, "Failed to open connection: " + ex.Message, this.formTitle, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    this.provider = DatabaseConnectionDialog.Show(this, this.provider.Identifier, this.provider.ConnectionString);
                }
            }
        }
Exemple #5
0
        public static IDatabaseProvider Show(IWin32Window owner, string connectionType, string connectionString)
        {
            DatabaseConnectionDialog dlg = new DatabaseConnectionDialog();

            if (connectionType == "MSSql")
            {
                dlg.ConnectorTabs.SelectedTab = dlg.ConnectorTabs.TabPages[connectionType];
                dlg.SqlProps.ConnectionStringBuilder.ConnectionString = connectionString;
            }
            else if (connectionType == "Oracle")
            {
                dlg.ConnectorTabs.SelectedTab = dlg.ConnectorTabs.TabPages[connectionType];
                dlg.OraProps.ConnectionStringBuilder.ConnectionString = connectionString;
            }

            dlg.ShowDialog(owner);
            return(dlg.Result);
        }