Ninja Database Pro
DeleteBackup Method
Example 



KellermanSoftware.NinjaDatabasePro Namespace > NinjaDbPro Class : DeleteBackup Method
Delete a backup set
Syntax
Public Sub DeleteBackup( _
   ByVal backupNumber As Integer _
) 
Dim instance As NinjaDbPro
Dim backupNumber As Integer
 
instance.DeleteBackup(backupNumber)
public void DeleteBackup( 
   int backupNumber
)
public:
void DeleteBackup( 
   int backupNumber
) 

Parameters

backupNumber
Example
NinjaDbPro db = new NinjaDbPro("MyDatabaseDirectory", "MyDatabaseName");
             
            //Licensed Mode
            //db.UserName = "John Smith 101224";
            //db.LicenseKey = "aousdf832jasf==";
             
            //Set before OpenDatabase. Default storage is IsolatedStorageDatabase. Other options are:
            //db.Storage = new MemoryDatabase(); //In memory database
            //db.Storage = new FileDatabase();  
             
            db.OpenDatabase();
             
            Person person1 = new Person();
            person1.Name = "John";
            db.Save(person1);
             
            db.CloseDatabase();
             
            //Backup the database to backup set 1
            db.Backup(1);
             
            //Delete the database
            db.DeleteEntireDatabase();
             
            //This will be false
            bool doesDatabaseExist = db.DoesDatabaseExist();
             
            //Restore the database from backup set 1
            db.Restore(1);
             
            //This will be true;
            doesDatabaseExist = db.DoesDatabaseExist();
             
            //Delete backup set 1
            db.DeleteBackup(1);
Dim db As New NinjaDbPro("MyDatabaseDirectory", "MyDatabaseName")
             
            'Licensed Mode
            'db.UserName = "John Smith 101224";
            'db.LicenseKey = "aousdf832jasf==";
             
            'Set before OpenDatabase. Default storage is IsolatedStorageDatabase. Other options are:
            'db.Storage = new MemoryDatabase(); //In memory database
            'db.Storage = new FileDatabase();  
             
            db.OpenDatabase()
             
            Dim person1 As New Person()
            person1.Name = "John"
            db.Save(person1)
             
            db.CloseDatabase()
             
            'Backup the database to backup set 1
            db.Backup(1)
             
            'Delete the database
            db.DeleteEntireDatabase()
             
            'This will be false
            Dim doesDatabaseExist As Boolean = db.DoesDatabaseExist()
             
            'Restore the database from backup set 1
            db.Restore(1)
             
            'This will be true;
            doesDatabaseExist = db.DoesDatabaseExist()
             
            'Delete backup set 1
            db.DeleteBackup(1)
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

NinjaDbPro Class
NinjaDbPro Members