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 OnContextMenu(object sender, MouseEventArgs e) { if (e.Button != MouseButtons.Right) { return; } Point pt = new Point(e.X, e.Y); TreeNode node = _treeView.GetNodeAt(pt); if (node == null) { return; } TableLink link = (node.Tag == null) ? null : node.Tag as TableLink; if (link != null) { _treeView.SelectedNode = node; _ctxtNode = node; ContextMenuStrip ctxtMenu = LoadContextMenu(); ctxtMenu.Show(_treeView, pt); } _treeView.SelectedNode = null; }
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); }
private void OnExport(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; } DataTable tbl = dbTree.Export(link.Cell); ShowTable(tbl, tbl.TableName); } //catch (Exception ex) //{ // MessageBox.Show(ex.Message); //} }