private void fillTreeView() { if (cmbServers.Items.Count == 0) { return; } //ama den iparxei kanenas server den to kanei sqlservers server = null; this.Invoke((MethodInvoker) delegate() { server = sqlservers.CreateSqlServerFromDataTable(serverData, cmbServers); }); ConnectionResultSet result = DB.TestConnection(server); if (result.wasSuccessful) { DbConnection con = DB.connect(server); List <string> databases = null; if (Utils._convert(server.db_type) == sqlbox.commons.DbType.SQLITE) { databases = new List <string>() { "main" }; } else { databases = new SqlBuilderFactory(server) .Create(null).removeSystemDatabases(DbDataHelper.getDatabases(server, con), !hideSystemDatabases); } foreach (string database in databases) { this.Invoke((MethodInvoker) delegate() { TreeNode node = new TreeNode(database); node.ImageIndex = 0; List <string> tables = DbDataHelper.getTables(server, database, con); foreach (string table in tables) { TreeNode tablenode = new TreeNode(table); tablenode.ImageIndex = 1; node.Nodes.Add(tablenode); } tvDatabases.Nodes.Add(node); }); } DB.close(con); } else { this.Invoke((MethodInvoker) delegate() { MessageBox.Show("Connection failed: \n" + result.errorMessage, "Test Connection", MessageBoxButtons.OK, MessageBoxIcon.Error); }); } }
private void ShowHideSystemDbEventClick(object sender, EventArgs e) { if (DB.IsConnected(this.con) && !core.sql.Utils.IsDbEmbedded(GetServer().db_type)) { this.tabView1.setServerDataToComboBox(new SqlBuilderFactory(GetServer()) .Create(null).removeSystemDatabases(DbDataHelper.getDatabases(this.server, this.con), this.showSystemDatabases = !this.showSystemDatabases)); } }
private void setConnectionAndServerToUserControls() { this.pushConnection(); if (core.sql.Utils._convert(GetServer().db_type) == sqlbox.commons.DbType.SQLITE) { this.tabView1.setServerDataToComboBox(new List <string>() { "main" }); } else { this.tabView1.setServerDataToComboBox(new SqlBuilderFactory(GetServer()) .Create(null).removeSystemDatabases(DbDataHelper.getDatabases(this.server, this.con), this.showSystemDatabases)); } }