예제 #1
0
        private void queryNavigator_Done(object sender, EventArgs e)
        {
            string fullquery = this.builder.BuildQuery(this.WhereText.Text, this.QueryExtText.Text);

            this.QueryText.Text             = fullquery;
            ExecutionTabControl.SelectedTab = SelectTabPage;

            try
            {
                using (new WaitCursor(this))
                {
                    // Set maxRows:
                    var maxRows = 500;
                    foreach (var item in this.QueryTree.GetRoots())
                    {
                        if (item is QueryModel qmItem)
                        {
                            maxRows = qmItem.MaxRows;
                        }
                    }

                    // Execute query and fill DataGridView:
                    DataTable dt = this.provider.ExecuteQuery(fullquery, maxRows);
                    Transform(dt);
                    ResultView.DataSource           = null;
                    ResultView.DataSource           = dt;
                    ExecutionTabControl.SelectedTab = ResultTabPage;

                    // Autosize columns:
                    ResultView.AutoResizeColumns();
                    foreach (DataGridViewColumn col in ResultView.Columns)
                    {
                        if (col.Width > 400)
                        {
                            col.Width = 400;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, this.formTitle, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }