Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Managing Subscriptions Via VB Code Expand / Collapse
Author
Message
Posted Wednesday, November 13, 2013 12:01 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Today @ 7:01 AM
Points: 43, Visits: 95
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)
Threading.Thread.Sleep(20000)
rs.DeleteSubscription(SubX.SubscriptionID)
End If
Next


Post #1514021
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse