CreateDatabase method

Creates a new UltraLite database.

Syntax
Visual Basic
Public Sub CreateDatabase( _
   ByVal connString As String, _
   ByVal collationData As Byte(), _
   ByVal createParms As String _
)
C#
public void CreateDatabase(
   string  connString,
   byte[] collationData,
   string  createParms
);
Parameters
  • connString   The parameters for identifying a database in the form of a semicolon-separated list of keyword-value pairs. For more information, see ULConnectionParms class.

  • collationData   The collation data specifying how the database will store and compare strings.

  • createParms   The parameters used to configure the new database in the form of a semicolon-separated list of keyword-value pairs. For more information, see ULCreateParms class.

Remarks

To specify a collation, you must first include the appropriate collation data source file from the UltraLite\Collations\cs (for C# projects) or UltraLite\Collations\vb.net (for Visual Basic projects) subdirectory of your SQL Anywhere installation directory. Once included in your project, use the collation's Data property to supply the collation data to the CreateDatabase() method.

Example

The following code creates the database \UltraLite\MyDatabase.udb on a Windows Mobile device then opens a connection to it.

' Visual Basic
Dim openParms As ULConnectionParms = New ULConnectionParms
openParms.DatabaseOnCE = "\UltraLite\MyDatabase.udb"
' Assumes file UltraLite\Collations\vb.net\coll_1250LATIN2.vb is
' also compiled in the current project
ULConnection.DatabaseManager.CreateDatabase( _
    openParms.ToString(), _
    iAnywhere.UltraLite.Collations.Collation_1250LATIN2.Data, _
    "" _
  )
Dim conn As ULConnection = _
  New ULConnection( openParms.ToString() )
conn.Open()
// C#
ULConnectionParms openParms = new ULConnectionParms();
openParms.DatabaseOnCE = @"\UltraLite\MyDatabase.udb";
// Assumes file UltraLite\Collations\cs\coll_1250LATIN2.cs is
// also compiled in the current project
ULConnection.DatabaseManager.CreateDatabase(
    openParms.ToString(),
    iAnywhere.UltraLite.Collations.Collation_1250LATIN2.Data,
    ""
  );
ULConnection conn = new ULConnection( openParms.ToString() );
conn.Open();
See also