protected void ActivateSQLCallback(object sender, object res)
        {
            DataTable results = (res as DataTable);

            DataGridView dataView = new DataGridView (results);
            Runtime.Gui.Workbench.ShowView (dataView, true);
        }
        void OnExecuteReturn(object sender, object results)
        {
            Runtime.Gui.StatusBar.SetMessage (
                GettextCatalog.GetString ("Query results received"));
            Runtime.Gui.StatusBar.SetProgressFraction (0.9);

            TextBuffer buf = (TextBuffer) sourceView.Buffer;
            if (results == null) {
                Runtime.Gui.StatusBar.ShowErrorMessage (
                    GettextCatalog.GetString ("Invalid select query"));
                if (executeMode == 1)
                    sourceView.ScrollToMark (buf.InsertMark, 0.4, true, 0.0, 1.0);
            } else {
                DataGridView dataView = new DataGridView (results as DataTable);
                Runtime.Gui.Workbench.ShowView (dataView, true);

                if (executeMode == 1) {
                    // execute multiple SQL
                    TextIter iter = buf.StartIter;
             					iter.Offset = offset;
                    string query = GetNextSqlStatement (buf, ref iter);
                    if (query.Trim ().Length > 0) {
                        SQLCallback callback = (SQLCallback)
                            Runtime.DispatchService.GuiDispatch (
                            new SQLCallback (OnExecuteReturn));

                        // move insert mark to end of SQL statement to be executed
                        buf.MoveMark (buf.InsertMark, iter);
                        buf.MoveMark (buf.SelectionBound, iter);

                        Runtime.Gui.StatusBar.SetMessage (
                            GettextCatalog.GetString ("Query sent, waiting for response."));
                        Runtime.Gui.StatusBar.SetProgressFraction (0.5);

                        executeMode = 1;
                        offset = iter.Offset;
                        Connection.ExecuteSQL (query, callback);
                    }
                    else {
                        sourceView.ScrollToMark (buf.InsertMark, 0.4, true, 0.0, 1.0);
                        Runtime.Gui.StatusBar.EndProgress ();
                    }
                }
                else {
                    sourceView.ScrollToMark (buf.InsertMark, 0.4, true, 0.0, 1.0);
                    Runtime.Gui.StatusBar.EndProgress ();
                }
            }
        }