Exemplo n.º 1
0
        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();
            DataSet ds2 = new DataSet();

            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();
            DataSet ds2 = new DataSet();

            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();
            }
        }