SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
Register Now and get your question answered!
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Analysis Server and Reporting Services (2008)
 Managing Report Subscriptions via VB Code
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

28 Posts

Posted - 11/13/2013 :  14:03:32  Show Profile  Reply with Quote
I am trying to create a report subscription on the fly, then fire the subscription, then delete the subscription immediately after. I have the first two steps figured out, but what I have realized is that if you don't give the report time to execute, it will get deleted first. I threw in a Sleep just to give the report I am testing time to run. But since this execution time varies immensely, i need something more reliable. Is there a way to check to see if the subscription is running, or has just finished, before deleting the subscription? The core of my code looks something like this:

Dim NewSubID As String = rs.CreateSubscription(rptName, extSettings, rptDesc, eventType, matchData, Nothing)

Dim MySubs As Subscription() = rs.ListSubscriptions(rptName)

For Each SubX As Subscription In MySubs
If SubX.SubscriptionID = NewSubID Then
rs.FireEvent(SubX.EventType, SubX.SubscriptionID, Nothing)
End If

James K
Flowing Fount of Yak Knowledge

3865 Posts

Posted - 11/13/2013 :  17:36:19  Show Profile  Reply with Quote
There lis a RunningJobs table that you might find useful. Also, a stored proc - ListRunningJobs.
Go to Top of Page

Starting Member

28 Posts

Posted - 11/14/2013 :  07:49:43  Show Profile  Reply with Quote
I do not believe I have access to that table. Is there any other way?
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000