SQLDMO events and C#

  • Thread starter Thread starter C# beginner
  • Start date Start date
C

C# beginner

Hi all,
I am using SQLDMO.Backup for backing up SQL server
databases. I need to implement a progress bar to show the
progress. I have some sample VB code that is like this:

Dim WithEvents oBackupEvent As SQLDMO.Backup

Set oBackupEvent = oBackup ' enable events
 
C# beginner said:
Hi all,
I am using SQLDMO.Backup for backing up SQL server
databases. I need to implement a progress bar to show the
progress. I have some sample VB code that is like this:

Dim WithEvents oBackupEvent As SQLDMO.Backup

Set oBackupEvent = oBackup ' enable events
You will need to declare the SQLDMO.Backup object so it has scope
throughout where you want to use it (usually the whole form).

private SQLDMO.Backup oBackupObject = new SQLDMO.Backup();

in the form constructor or wherever, add a handler for the event;

oBackupObject.PercentComplente += new
SQLDMO.PercentCompleteDelegateNameHere(this.SQLBackupPercentComplete);

this points to

private void SQLBackupPercentComplete(string message, long percent)
{
...
}

if you type in oBackupObject.PercentComplente +=, you should be able to
press tab and the ide should fill in the rest for you.


HTH

JB
 
Back
Top