private void RenderResult(IScriptEditor editor, TabControl tabControl, ScriptExecutionResult execResult)
        {
            if (execResult == null || execResult.DataSets == null || execResult.DataSets.Count == 0)
            {
                return;
            }

            foreach (DataSet dataSet in execResult.DataSets)
            {
                if (dataSet == null || dataSet.Tables.Count == 0)
                {
                    continue;
                }

                DataSetInfo dsInfo = editor.GetDataSetInfo(dataSet);

                string  tabCaption = String.Format("{0} result(s) [{1}]", dataSet.Tables.Count, dsInfo.ServerDbInfo);
                TabPage tp         = new TabPage(tabCaption);
                tp.ToolTipText = tabCaption;

                tabControl.TabPages.Add(tp);

                VirtualDBQueryResultViewer viewer = new VirtualDBQueryResultViewer();
                viewer.Parent             = tp;
                viewer.Dock               = DockStyle.Fill;
                viewer.ActiveGridChanged += new ActiveGridChangedDelegate(viewer_ActiveGridChanged);
                viewer.RenderDataSet(editor, dataSet);

                _disposeList.Add(viewer);
            }
        }
Esempio n. 2
0
        private void RenderResult(IScriptEditor editor, TabControl tabControl, ScriptExecutionResult execResult)
        {
            if (execResult == null || execResult.DataSets == null || execResult.DataSets.Count == 0)
            {
                return;
            }

            TabPage          tp  = null;
            DxResultRenderer grd = null;
            int tblNo            = 1;

            foreach (DataSet ds in execResult.DataSets)
            {
                if (ds == null || ds.Tables.Count == 0)
                {
                    continue;
                }

                DataSetInfo dsInfo = editor.GetDataSetInfo(ds);
                tblNo = 1;
                foreach (DataTable tbl in ds.Tables)
                {
                    string tabCaption = String.Format("Qry {0}.{1} [{2}]", dsInfo.BatchNo, tblNo, tbl.Rows.Count);
                    tp             = new TabPage(tabCaption);
                    tp.ToolTipText = String.Format(tabCaption + " [{0}]", dsInfo.ServerDbInfo);

                    tabControl.TabPages.Add(tp);

                    grd = new DxResultRenderer();
                    tp.Controls.Add(grd);

                    grd.Enter += new EventHandler(grd_Enter);

                    editor.PrepareAddInSupportForResultContextMenu(grd.PopUpMenu.Items);
                    grd.Parent = tp;
                    grd.Dock   = DockStyle.Fill;
                    grd.RenderDataTable(tbl);
                    _disposeList.Add(grd);
                    tblNo++;
                }
            }
        }