ISetDatabaseFactory.GetSetDatabase Method

Creates the ISetDatabase instance for the specified file or database.
Function GetSetDatabase( _ 
ByVal filePath As String
) As ISetDatabase
This language is not supported or no code example is available.
ISetDatabase GetSetDatabase( 
string filePath 
)
This language is not supported or no code example is available.

Parameters

filePath
string

Required. The full database path of the set database whose instance is to be retrieved. For SQL Server database it is the connection string, for SQLite database it is the full path to the file. See remarks for more details.

Return Value

ISetDatabase

The set database loaded from the file or database.

Remarks
 

To check whether a database comes from an SQLServer, you can test whether the connection string starts with "ProviderRemoteDatabaseServer".

To connect to SQL server databases, the filePath parameter should have the following format:

ProviderRemoteDatabaseServer;<DATABASE_PATH>\<DATABASE_NAME>

You can get the full database path string using the IQdvEnvironment.GetDatabasePath method, as you would do with a local database:

DbPath = context.QdvManager.Environment.GetDatabasePath(PathNumber)

The database name may look like "MyDatabase.grp"

The resulting string may then look as follows:

ProviderRemoteDatabaseServer;128.1.2.3;QDV_databases;DBTESTS;4xrODLGqs+EHmfJm6YHRYQ==;False\MyDatabase.grp

Then open the database as usual:

SetDb = context.QdvManager.SetDatabaseFactory.GetSetDatabase("ProviderRemoteDatabaseServer;128.1.2.3;QDV_databases;DBTESTS;4xrODLGqs+EHmfJm6YHRYQ==;False\MyDatabase.grp")

Note

If you call this code from an external application and not from a macro, then you need to put the following lines in your App.config file:

<system.data>
   <DbProviderFactories>
     <remove invariant="System.Data.SQLite" />
     <add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".Net Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
     <remove invariant="QuickDevis.Server" />
     <add name="Service Data Provider" invariant="QuickDevis.Server" description=".Net Framework Data Provider for Web Services" type="QuickDevis.Server.DbProviderFactoryService, QuickDevis.Server" />
   </DbProviderFactories>
 </system.data>
 <appSettings>
   <!-- Which provider? -->
   <add key="ProviderRemoteDatabaseServer" value="System.Data.SqlClient" />
   <add key="ProviderLocalDatabaseServer" value="System.Data.SQLite" />
 </appSettings>					
Version
 
Available since QDV 7.18.660.

.NET Framework

Supported in: 4.8, 4.7, 4.6, 4.5.2

In this article

Definition