Ejemplo n.º 1
0
        private void btnQuery_Click(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;

            // 保存当前查询
            if (!this.chkUseOriginal.Checked)
            {
                this.currentSql = this.txtSql.Text;
            }

            // 为查询结果准备 DataSet
            DataSet ds1 = new DataSet()
            {
                Locale = CultureInfo.CurrentUICulture
            };
            DataSet ds2 = new DataSet()
            {
                Locale = CultureInfo.CurrentUICulture
            };

            if (chkUseOriginal.Checked)
            {
                QueryExecution.ExecuteOriginalQueries(ds1, ds2, this.queryInfos, this.connection);
            }
            else if (this.twoQueries)
            {
                QueryExecution.ExecuteQueries(ds1, ds2, this.sql1, this.sql2, this.connection);
            }
            else
            {
                QueryExecution.ExecuteQuery(ds1, this.sql1, this.connection);
            }

            if (this.twoQueries)
            {
                QueryResult2 form = new QueryResult2();
                form.SetDataSets(ds1, ds2);
                this.Cursor = Cursors.Default;
                form.ShowDialog();
            }
            else
            {
                QueryResult form = new QueryResult();
                form.SetDataSet(ds1);
                this.Cursor = Cursors.Default;
                form.ShowDialog();
            }
        }
Ejemplo n.º 2
0
        private void btnQuery_Click(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;

            // сохранение текущего запроса
            if (!this.chkUseOriginal.Checked)
            {
                this.currentSql = this.txtSql.Text;
            }

            // подготовка наборов данных для результатов запроса
            DataSet ds1 = new DataSet()
            {
                Locale = CultureInfo.CurrentUICulture
            };
            DataSet ds2 = new DataSet()
            {
                Locale = CultureInfo.CurrentUICulture
            };

            if (chkUseOriginal.Checked)
            {
                QueryExecution.ExecuteOriginalQueries(ds1, ds2, this.queryInfos, this.connection);
            }
            else if (this.twoQueries)
            {
                QueryExecution.ExecuteQueries(ds1, ds2, this.sql1, this.sql2, this.connection);
            }
            else
            {
                QueryExecution.ExecuteQuery(ds1, this.sql1, this.connection);
            }

            if (this.twoQueries)
            {
                QueryResult2 form = new QueryResult2();
                form.SetDataSets(ds1, ds2);
                this.Cursor = Cursors.Default;
                form.ShowDialog();
            }
            else
            {
                QueryResult form = new QueryResult();
                form.SetDataSet(ds1);
                this.Cursor = Cursors.Default;
                form.ShowDialog();
            }
        }
        private void btnQuery_Click(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;

            // save current query
            if (!this.chkUseOriginal.Checked) {
                this.currentSql = this.txtSql.Text;
            }

            // prepare DataSet(s) for the query results
            DataSet ds1 = new DataSet() { Locale = CultureInfo.CurrentUICulture };
            DataSet ds2 = new DataSet() { Locale = CultureInfo.CurrentUICulture };

            if (chkUseOriginal.Checked) {
                QueryExecution.ExecuteOriginalQueries(ds1, ds2, this.queryInfos, this.connection);
            } else if (this.twoQueries) {
                QueryExecution.ExecuteQueries(ds1, ds2, this.sql1, this.sql2, this.connection);
            } else {
                QueryExecution.ExecuteQuery(ds1, this.sql1, this.connection);
            }

            if (this.twoQueries) {
                QueryResult2 form = new QueryResult2();
                form.SetDataSets(ds1, ds2);
                this.Cursor = Cursors.Default;
                form.ShowDialog();
            } else {
                QueryResult form = new QueryResult();
                form.SetDataSet(ds1);
                this.Cursor = Cursors.Default;
                form.ShowDialog();
            }
        }