Example #1
0
        private void objRemoveColumnSQL_Click(object sender, EventArgs e)
        {
            using (RemoveColumn pRemoveColumn = new RemoveColumn())
            {
                pRemoveColumn.ShowInTaskbar = false;
                string message = null;
                if (DialogResult.OK == pRemoveColumn.ShowDialog() & !string.IsNullOrEmpty(pRemoveColumn.ColumnName))
                {
                    // StatementParser.ReturnResults(StatementBuilder.BuildAddColumnSQL(DatabaseTreeView.SelectedNode.Text, pRemoveColumn.ColumnName, pRemoveColumn.ColumnType), ActiveDatabaseLocation);
                    SQLiteDatabase db = new SQLiteDatabase(ActiveDatabaseLocation);
                    int Records = db.removeColumn(DatabaseTreeView.SelectedNode.Text, pRemoveColumn.ColumnName);

                    //Add new column to the tree if it is expanded
                    if (DatabaseTreeView.SelectedNode.IsExpanded & Records > -1)
                    {
                        TreeNode columnNode = new TreeNode();
                        columnNode.Text = pRemoveColumn.ColumnName;
                        columnNode.Tag = pRemoveColumn.ColumnName;
                        DatabaseTreeView.SelectedNode.Nodes[0].Nodes.Remove(columnNode);

                        DatabaseTreeView.SelectedNode.Collapse();
                        DatabaseTreeView.SelectedNode.Expand();

                    }
                    message = String.Format("ExecuteNonQurey: Records updated {0}", Records);
                }
                else
                    message = "Remove Column Aborted";
                StatusStripLog.Text = message;
            }
        }