private void btSelect_Click(object sender, EventArgs e) { if (openFileDialog1.ShowDialog() != DialogResult.OK) { return; } string fileName = openFileDialog1.FileName; tbFileName.Text = fileName; db.Close(); if (!string.IsNullOrEmpty(fileName) && File.Exists(fileName)) { LoadDatabase(fileName, null); } SetActiveButtons(); }
/// <summary> /// Reset components and close database connection /// </summary> private void Reset() { dataGrid.DataSource = null; db.Close(); treeDb.Nodes.Clear(); rtbDdl.Clear(); rtbQuery.Clear(); btnQuery.Checked = btnQuery.Enabled = btnExecute.Enabled = btnClear.Enabled = importMenuItem.Enabled = exportMenuItem.Enabled = saveSchemaMenuItem.Enabled = saveSqlMenuItem.Enabled = closeDatabaseMenuItem.Enabled = loadSqlMenuItem.Enabled = printMenuItem.Enabled = previewMenuItem.Enabled = false; splitterHorizontal.Panel1Collapsed = splitterHorizontal.IsSplitterFixed = true; Text = formText; tabControl1.SelectedIndex = 0; }