Ninja Database Pro
OpenDatabase Method
Example 



KellermanSoftware.NinjaDatabasePro Namespace > NinjaDbPro Class : OpenDatabase Method
Open the database before performing any operation. If the database does not exist it will automatically be created.
Syntax
Public Sub OpenDatabase() 
Dim instance As NinjaDbPro
 
instance.OpenDatabase()
public void OpenDatabase()
public:
void OpenDatabase(); 
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();
             
            //The database is now open
            bool isDatabaseOpen = db.IsDatabaseOpen;
             
            db.CloseDatabase();
             
            //The database is closed
            isDatabaseOpen = db.IsDatabaseOpen;
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()
             
            'The database is now open
            Dim isDatabaseOpen As Boolean = db.IsDatabaseOpen
             
            db.CloseDatabase()
             
            'The database is closed
            isDatabaseOpen = db.IsDatabaseOpen
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