Contents Index Properties CreateDatabaseWithParms method

UltraLite for MobileVB User's Guide
  UltraLite for MobileVB API Reference
    ULDatabaseManager class

CreateDatabase method


CreateDatabase creates a new database and returns a connection to it.

Prototype 

CreateDatabase( parms As String ) As ULConnection
Member of UltraLiteAFLib.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 ApplyFile 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.

For more information about ApplyFile, see ULDatabaseSchema class and ApplyFile method.

Parameters 

parms    A semicolon-separated list of database creation parameters.

Note for VFS card for Palm users  
The Palm_fs=vfs parameter needs to be specified both for CreateDatabase and OpenConnection methods if you want to have the database reside on the virtual file system.

For information about connection parameters, see Connection Parameters.

For more information about the Palm_fs parameter, see palm_fs parameter .

Returns 

Returns a connection to a newly created UltraLite database.

Examples 

The following code creates a ULDatabaseManager object. This is the first object you create when writing for UltraLite for MobileVB. Note that CreateDatabase requires that no .udb file exists, and OpenConnection is used when a .udb file already exists.

Dim conn_parms As String
Dim open_parms As String
Dim schema_parms As String

conn_parms = "uid=DBA;pwd=SQL"
open_parms = conn_parms & ";" & _
    "PALM_DB=Syb3;file_name=c:\tutorial\tutCustomer.udb"
schema_parms = open_parms & ";" & _
    "PALM_SCHEMA=tutCustomer;" & _
    "schema_file=c:\tutorial\tutCustomer.usm"

On Error Resume Next

Set Connection = DatabaseMgr.OpenConnection(open_parms)
If Err.Number =  _
    ULSQLCode.ulSQLE_DATABASE_NOT_FOUND _
Then
    Err.Clear
        Set Connection = _
    DatabaseMgr.CreateDatabase(schema_parms)
    If Err.Number <> 0 Then
            MsgBox Err.Description
    End If
End If

For information about connection parameters, see OpenConnection method.


Contents Index Properties CreateDatabaseWithParms method