private void OnSqlQuery(object sender, EventArgs e) { //try { TableLink link = (_ctxtNode.Tag == null) ? null : _ctxtNode.Tag as TableLink; if (link == null) { return; } IDBObjectTree dbTree = link.Tree as IDBObjectTree; if (dbTree == null) { return; } DBObjectIdentifier id = dbTree.GetIdentifier(link.Cell); string selectSql = string.Format("SELECT * FROM {0}", id.FullName); TabPage tp = Zen.UIControls.CtrlBuilder.BuildTabPage(string.Format("Query{0}", _sqlTabCount++), _tabDetailView.Size, _tabDetailView.Controls.Count); SqlControl ctrl = new SqlControl(); ctrl.Dock = DockStyle.Fill; ctrl.SqlText = selectSql; ctrl.DataSource = dbTree.DataSource; tp.Controls.Add(ctrl); _tabDetailView.Controls.Add(tp); } //catch (Exception ex) //{ // MessageBox.Show(ex.Message); //} }
private void OnTableToObj(object sender, EventArgs e) { TableLink link = (_ctxtNode.Tag == null) ? null : _ctxtNode.Tag as TableLink; if (link == null) { return; } IDBObjectTree dbTree = link.Tree as IDBObjectTree; if (dbTree == null) { return; } DBObjectIdentifier id = dbTree.GetIdentifier(link.Cell); TableSchema schema = new TableSchema(dbTree.DataSource, id.FullName); ShowTable(schema.ColumnDefs, id.Name); }