private void NewQuery(SODatabase db, string sqlText) { QueryAnalyzer qa = new QueryAnalyzer(); qa.CurrentDatabase = db; base.MainForm.SetCurrentDB(db); int count = 1; string fileName = string.Format("SqlQuery{0}.sql", count.ToString()); while (base.MainForm.FindDockDocument(fileName) != null) { count++; fileName = string.Format("SqlQuery{0}.sql", count.ToString()); } qa.FileName = fileName; qa.SqlText = sqlText; qa.Show(DockPanel); }