Showing posts with label automatically. Show all posts
Showing posts with label automatically. Show all posts

Friday, March 30, 2012

load CatalogItem array in treeview

Hi,

i would like to load my array 'items' in a treeview

CatalogItem[] items = rs.ListChildren("/", true);

is there anyway that automatically does the layout or do i have to check what the type is of everey object so I can indent correctly.

thanks
I'm really looking for this one :).

I'm trying to do it manually but I can't find a way to get the reports in the right structure. I'll show what I want to accomplish and how I am trying it now:

WANTED LIST:
+ Adventureworks
- Company Sales
- Employee Sales Summary
+ Subfolder
- Report from subfolder
- Report from subfolder

Code trying to get there (not thinking of subfolders yet):

rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
CatalogItem[] items = rs.ListChildren("/", false);
foreach (CatalogItem ci in items)
{
cmbRapporten.Nodes.Add(ci.Name);
CatalogItem[] test = rs.ListChildren("/" + ci.Name.ToString(), false);
foreach(CatalogItem ti in test)
{
cmbRapporten.Nodes.Add(ti.Name);
}
}
EXPLANATION

I ask for the root folder's children (not recursive) and then list them in my treeview cmbRapporten then I create a new CatalogItem[] = test, where I list the children of the current folder in the CatalogItem[] items. Everything appears fine but it's all in one line down. How do I couple them with their parents folder.

greetings
|||Hi,

so I got there to fill the treeview not looking at subfolders with this code (pretty simple if you ask me ;))

[CODE]
ReportingService2005 rs = new ReportingService2005();
rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
CatalogItem[] items = rs.ListChildren("/", false);
foreach (CatalogItem item in items)
{
cmbRapporten.Nodes.Add(item.Name);
if (item.Type.ToString() == "Folder")
{
CatalogItem[] childs = rs.ListChildren("/" + item.Name.ToString(), false);
foreach (CatalogItem child in childs)
{
cmbRapporten.Nodes[counter].Nodes.Add(child.Name);
}
counter++;
}
}
[/CODE]

Gives me a nice treeview in the designer but I'm still not content ;).

If one of the items in the object childs is a folder then there should be added another subnode. I'll visualize it for better understanding:

Now i support:

+ FOLDER
-REPORT
-REPORT
-SUBFOLDER
-REPORT

But I want the subfolder to display it's items too. So I will have to make a generic method and then call it with two parameters i thought. The string path wich is the path on the report server that should List it's children. Second of al I have to pass the Node number. But sometimes I will have to pass one node number while other times I will have to pass multiple node numbers... I have no idea to make such an method. Could somebody help with this.

Do I make sense or should I rephrase everything.

Greetings

Wednesday, March 7, 2012

List of Backups is too big

I have a Maintenance Plan which runs Backup of DB every hour. Backups older
than 2 weeks are deleted automatically. If I check the contents of the
folder containing Backup files then I do not see there those old files which
had to be deleted. They were really deleted. But if I select Restore
Database in EM then I get the list of all files, including deleted ones.
I noticed that the list of Backup files is delivered with bigger and bigger
delay. Maybe I'm wrong but I think it's because of the size of that list.
I'm working with remote Database through VPN connection and I would like to
find the way to make the list of Backup files contain only existing files.
Thank you
Al
That is because each time you backup using the SQL Server Backup command(or
thru the wizard) a row is added to the backup history tables. These rows
are never deleted automatically. You must set up a job or manually run
sp_delete_backuphistory on a regular basis to cap the number of rows in the
history tables. Be aware that the first time you run it the response will
be slow if there are lots of rows in the tables. Once you get it down to a
reasonable size it works just fine.
Andrew J. Kelly SQL MVP
"vul" <aaa@.optonline.net> wrote in message
news:u2m0hnh1EHA.3588@.TK2MSFTNGP14.phx.gbl...
>I have a Maintenance Plan which runs Backup of DB every hour. Backups older
> than 2 weeks are deleted automatically. If I check the contents of the
> folder containing Backup files then I do not see there those old files
> which
> had to be deleted. They were really deleted. But if I select Restore
> Database in EM then I get the list of all files, including deleted ones.
> I noticed that the list of Backup files is delivered with bigger and
> bigger
> delay. Maybe I'm wrong but I think it's because of the size of that list.
> I'm working with remote Database through VPN connection and I would like
> to
> find the way to make the list of Backup files contain only existing files.
> Thank you
> Al
>
|||Thank you very much, Andrew
Al
"Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
news:#JxGC9h1EHA.1860@.TK2MSFTNGP15.phx.gbl...
> That is because each time you backup using the SQL Server Backup
command(or
> thru the wizard) a row is added to the backup history tables. These rows
> are never deleted automatically. You must set up a job or manually run
> sp_delete_backuphistory on a regular basis to cap the number of rows in
the
> history tables. Be aware that the first time you run it the response will
> be slow if there are lots of rows in the tables. Once you get it down to
a[vbcol=seagreen]
> reasonable size it works just fine.
>
> --
> Andrew J. Kelly SQL MVP
>
> "vul" <aaa@.optonline.net> wrote in message
> news:u2m0hnh1EHA.3588@.TK2MSFTNGP14.phx.gbl...
older[vbcol=seagreen]
list.[vbcol=seagreen]
files.
>