Quantcast
Channel: SQLServerCentral » Reporting Services » Reporting Services » Latest topics
Viewing all articles
Browse latest Browse all 2791

Managing Subscriptions Via VB Code

$
0
0
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:[code="vb"] 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) Threading.Thread.Sleep(20000) rs.DeleteSubscription(SubX.SubscriptionID) End If Next[/code]

Viewing all articles
Browse latest Browse all 2791

Trending Articles