Ninja Database Pro
IsTransactionOpen Property
Example 



KellermanSoftware.NinjaDatabasePro Namespace > NinjaDbPro Class : IsTransactionOpen Property
If true, a transaction is open
Syntax
Public ReadOnly Property IsTransactionOpen As Boolean
Dim instance As NinjaDbPro
Dim value As Boolean
 
value = instance.IsTransactionOpen
public bool IsTransactionOpen {get;}
public:
property bool IsTransactionOpen {
   bool get();
}
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();  
             
            Person person = new Person();
            person.Name = "John";
             
            db.OpenDatabase();
            db.BeginTransaction();
            bool isTransactionOpen = db.IsTransactionOpen; //This will be true
            person.Name = "John Smith";
            db.Save(person);
            db.CommitTransaction();
             
            isTransactionOpen = db.IsTransactionOpen; //This will be false
             
            db.CloseDatabase();
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();  
             
            Dim person As New Person()
            person.Name = "John"
             
            db.OpenDatabase()
            db.BeginTransaction()
            Dim isTransactionOpen As Boolean = db.IsTransactionOpen 'This will be true
            person.Name = "John Smith"
            db.Save(person)
            db.CommitTransaction()
             
            isTransactionOpen = db.IsTransactionOpen 'This will be false
             
            db.CloseDatabase()
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