Contents Index CreateDatabase method DropDatabase method

UltraLite ActiveX User's Guide
  UltraLite ActiveX API Reference
    ULDatabaseManager class

CreateDatabaseWithParms method


CreateDatabaseWithParms creates a new database using a connection parameter object, and returns a connection to it.

Prototype 

CreateDatabaseWithParms( parms As ULConnectionParms ) As ULConnection
Member of UltraliteActiveX.ULDatabaseManager

Description 

Creates a new database and returns a connection to it. It fails if the specified database already exists. A valid schema file must be specified to successfully create a database. To alter the schema of an existing database, use the ULDatabaseSchema.ApplyFileWithParms method.

Caution  
Only one database may be active at a given time. Attempts to create a different database while other connections are open will result in an error.
Parameters 

parms    A ULConnectionParms object that holds a set of connection parameters.

Returns 

Returns a connection to a newly created UltraLite database. Fails if the specified database already exists.

Examples 

The following example assumes you have placed the ULConnectionParms object on your form, named it LoginParms and have specified the database locations and schema locations in the Connection parms properties window.

The example below uses CreateDatabaseWithParms to create and open a new database.

' eMbedded Visual Basic
' Use CreateObject in to get an instance of the ULDatabaseManager object
Set DatabaseMgr = CreateObject("UltraLite.ULDatabaseManager")
' Use CreateObject to get an instance of the ULConnectionParms object
Dim LoginParms As ULConnectionParms
Set LoginParms = CreateObject("UltraLite.ULConnectionParms")
LoginParms.DatabaseOnCE = "/tutorial/tutorial.udb"
LoginParms.SchemaOnCE = "/tutorial/tutorial.usm"
' Drop the existing database and create a new database
Call DatabaseMgr.DropDatabaseWithParms( LoginParms )
Set Connection = DatabaseMgr.CreateDatabaseWithParms(LoginParms)
// JScript
' get an instance of the ULDatabaseManager object
DatabaseMgr = new ActiveXObject("UltraLite.ULDatabaseManager");
var LoginParms;
LoginParms = new ActiveXObject("UltraLite.ULConnectionParms");
LoginParms.DatabaseOnCE = "//tutorial//tutorial.udb";
LoginParms.SchemaOnCE = "//tutorial//tutorial.usm";
' Drop the existing database and create a new database
DatabaseMgr.DropDatabaseWithParms( LoginParms );
Connection = DatabaseMgr.CreateDatabaseWithParms( LoginParms );

Contents Index CreateDatabase method DropDatabase method