Click here to monitor SSC
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase

Managing Subscriptions Via VB Code Expand / Collapse
Posted Wednesday, November 13, 2013 12:01 PM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Wednesday, November 30, 2016 5:34 AM
Points: 52, Visits: 151
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

Post #1514021
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse