Ejemplo n.º 1
0
        private void SqlExecute_Click(object sender, System.EventArgs e)
        {
            if (richTextBox1.Text.Length > 0 && database != null)
            {
                SqliteVm vm     = new SqliteVm(database, true);
                string   sql    = richTextBox1.Text;
                int      sqlErr = Sqlite.Error;
                try
                {
                    sqlErr = vm.Execute(sql);
                }
                catch (SEHException)
                {
                    // Do nothing.  Execution failed...
                }

                if (sqlErr != Sqlite.Done && sqlErr != Sqlite.Ok)
                {
                    string errMsg = vm.GetErrMsg();
                    errMsg += "\n";
                    errMsg += vm.GetQueryTail();
                    MessageBox.Show(errMsg, "Sqlite Execution Error");

                    vm.SqlFinalize();
                    vm = null;
                }
                else
                {
                    vm.SqlFinalize();
                    vm = null;

                    // reload database
                    OpenDatabase(databaseName);
                }
            }
        }
Ejemplo n.º 2
0
        private void SqlExecute_Click(object sender, System.EventArgs e)
        {
            if (richTextBox1.Text.Length > 0 && database != null)
            {
                SqliteVm vm = new SqliteVm(database, true);
                string sql = richTextBox1.Text;
                int sqlErr = Sqlite.Error;
                try
                {
                    sqlErr = vm.Execute(sql);
                }
                catch (SEHException)
                {
                    // Do nothing.  Execution failed...
                }

                if (sqlErr != Sqlite.Done && sqlErr != Sqlite.Ok)
                {
                    string errMsg = vm.GetErrMsg();
                    errMsg += "\n";
                    errMsg += vm.GetQueryTail();
                    MessageBox.Show(errMsg, "Sqlite Execution Error");

                    vm.SqlFinalize();
                    vm = null;
                }
                else
                {
                    vm.SqlFinalize();
                    vm = null;

                    // reload database
                    OpenDatabase(databaseName);
                }
            }
        }