August 27, 2008 at 11:35 am
hi there,
i am searching for a way to show the percentcomplete event with vbs.
i've googled the whole inet but havn't found anything that work.
so if anybody have succsessful tested this, an example is very very welcome.
greetz
*M*
August 27, 2008 at 11:56 am
I don't think that you can receive events in VBScript or Jscript can you?
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
August 28, 2008 at 9:56 am
for wmi events there exist the WbemScripting.SWbemSink event sink which works fine but i have no idea how to implement a event sink for the sqldmo Backup event.
*M*
September 4, 2008 at 8:52 am
michael.anyone (8/28/2008)
for wmi events there exist the WbemScripting.SWbemSink event sink which works fine but i have no idea how to implement a event sink for the sqldmo Backup event.*M*
I think rbarryyoung is correct. I would love to be proved wrong though. 😉 I have dug out a VB6 app I wrote about 6 years ago that did get events, to refresh a progressBar, but I had to do the following to get it to go:
' Declare a WithEvents Object (IOW, use Early Binding)
Dim WithEvents oRestoreEvent As SQLDMO.Restore
' I can't remember why I did this...
Attribute oRestoreEvent.VB_VarHelpID = -1
'Create a DMO restore object
Set oRestore = New SQLDMO.Restore2
'Copy reference (correct terminology?) of said restore object
Set oRestoreEvent = oRestore ' enable events
'Create event handler sub-routines
Private Sub oRestoreEvent_Complete(ByVal Message As String)
'BackupStatusBar.SimpleText = Message
On Error Resume Next
BackupStatusBar.Panels.Item(1) = "DB " & cmbDatabaseName.Text & " Restored"
frmMain.Caption = "DB Safe"
BackupProgressBar.Value = 0
DoEvents
End Sub 'oRestoreEvent_Complete(ByVal Message As String)
'=========================================================================================
Private Sub oRestoreEvent_NextMedia(ByVal Message As String)
On Error Resume Next
'Dummy event handler
Exit Sub
End Sub 'oRestoreEvent_NextMedia(ByVal Message As String)
'=========================================================================================
Private Sub oRestoreEvent_PercentComplete(ByVal Message As String, ByVal Percent As Long)
On Error Resume Next
BackupStatusBar.Panels.Item(1) = CStr(Percent) & "% restored"
frmMain.Caption = CStr(Percent) & "% restored"
BackupProgressBar.Value = Percent
DoEvents
End Sub 'oRestoreEvent_PercentComplete(ByVal Message As String, ByVal Percent As Long)
HTH
Dave J
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply