QDatabase Constructor (filePath, mode)

Microsoft Deployment Compression & Installer

Copy image CopyHover image
Deployment Tools Foundation QDatabase Constructor (filePath, mode)
Deployment Tools Foundation NamespacesMicrosoft.Deployment.WindowsInstaller.LinqQDatabaseQDatabase(String, DatabaseOpenMode)
Opens an existing database or creates a new one.
Declaration Syntax
C# Visual Basic Visual C++
public QDatabase(
	string filePath,
	DatabaseOpenMode mode
)
Public Sub New ( 
	filePath As String,
	mode As DatabaseOpenMode
)
public:
QDatabase(
	String^ filePath, 
	DatabaseOpenMode mode
)
Parameters
filePath (String)
Path to the database file. If an empty string is supplied, a temporary database is created that is not persisted.
mode (DatabaseOpenMode)
Open mode for the database
Remarks
To make and save changes to a database first open the database in transaction, create or, or direct mode. After making the changes, always call the Commit method before closing the database handle. The Commit method flushes all buffers.

Always call the Commit method on a database that has been opened in direct mode before closing the database. Failure to do this may corrupt the database.

Because this constructor initiates database access, it cannot be used with a running installation.

The Database object should be Close()()()()d after use. The finalizer will close the handle if it is still open, however due to the nondeterministic nature of finalization it is best that the handle be closed manually as soon as it is no longer needed, as leaving lots of unused handles open can degrade performance.

Exceptions
Exception Condition
InstallerException the database could not be created/opened

Assembly: Microsoft.Deployment.WindowsInstaller.Linq (Module: Microsoft.Deployment.WindowsInstaller.Linq.dll) Version: 3.0.0.0 (3.9.1006.0)