AccessProviderSample.AccessDBProvider.RemoveItem C# (CSharp) Method

RemoveItem() protected method

Removes (deletes) the item at the specified path
There are no elements in this store which are hidden from the user. Hence this method will not check for the presence of the Force parameter
protected RemoveItem ( string path, bool recurse ) : void
path string /// The path to the item to remove. ///
recurse bool /// True if all children in a subtree should be removed, false if only /// the item at the specified path should be removed. Is applicable /// only for container (table) items. Its ignored otherwise (even if /// specified). ///
return void
        protected override void RemoveItem(string path, bool recurse)
        {
            string tableName;
            int rowNumber = 0;

            PathType type = GetNamesFromPath(path, out tableName, out rowNumber);

            if (type == PathType.Table)
            {
                // if recurse flag has been specified, delete all the rows as well
                if (recurse)
                {
                    OdbcDataAdapter da = GetAdapterForTable(tableName);
                    if (da == null)
                    {
                        return;
                    }

                    DataSet ds = GetDataSetForTable(da, tableName);
                    DataTable table = GetDataTable(ds, tableName);

                    for (int i = 0; i < table.Rows.Count; i++)
                    {
                        table.Rows[i].Delete();
                    }

                    if (ShouldProcess(path, "RemoveItem"))
                    {
                        da.Update(ds, tableName);
                        RemoveTable(tableName);
                    }
                }//if (recurse...
                else
                {
                    // Remove the table
                    if (ShouldProcess(path, "RemoveItem"))
                    {
                        RemoveTable(tableName);
                    }
                }
            }
            else if (type == PathType.Row)
            {
                OdbcDataAdapter da = GetAdapterForTable(tableName);
                if (da == null)
                {
                    return;
                }

                DataSet ds = GetDataSetForTable(da, tableName);
                DataTable table = GetDataTable(ds, tableName);

                table.Rows[rowNumber].Delete();

                if (ShouldProcess(path, "RemoveItem"))
                {
                    da.Update(ds, tableName);
                }
            }
            else
            {
                ThrowTerminatingInvalidPathException(path);
            }
        }