Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SAP Sybase SQL Anywhere 16.0 » UltraLite - .NET Programming » Tutorial: Building a Windows Mobile application using UltraLite.NET

 

Lesson 2: Creating an UltraLite database

In this lesson, you create an UltraLite database using Sybase Central on a desktop PC.

Prérequis

This lesson assumes you have completed all preceding lessons. See Lesson 1: Creating a Visual Studio project.

 Task
  1. Click Start » Programs » SQL Anywhere 16 » Administration Tools » Sybase Central.

  2. Use the UltraLite plug-in for Sybase Central to create a database in the same directory as your application.

    From the Tools menu, click UltraLite 16 » Create Database.

    In general, the default database characteristics provided by Sybase Central are suitable. Note the following characteristics:

    • Database file name   c:\tutorial\uldotnet\VBApp\VBApp.udb or c:\tutorial\uldotnet\CSApp\CSApp.udb, depending on your application type.

    • DBA user ID and password   Set to DBA and sql, respectively, for the purposes of examples in this documentation.

    • Collation sequence   Use the default collation.

    • Use case-sensitive string comparisons   This option should not be on.

    Click Finish and connect to the UltraLite database.

  3. Create a new UltraLite table by highlighting the Tables folder icon in the Sybase Central tree view and then click File » New » Table. Note the following characteristics:

    • Table name   Type Names.

    • Columns   Create columns in the Names table with the following attributes:

      Column Name Data Type (Size) Nulls Unique Default value
      ID Integer No Yes (primary key) Global autoincrement
      Name Varchar(30) No No None

    • Primary key   Specify the ID column as primary key.

  4. Exit Sybase Central and verify the database file is created in the required directory.

  5. Link the initialized (empty) database file to your Visual Studio project so that the database file is deployed to the device along with the application code:

    • From the Visual Studio menu, click Project » Add Existing Item.

    • Ensure that Objects of Type is set to All Files. Browse to the directory where you created the database file and click the file VBApp.udb or CSApp.udb depending on your application type.

    • Click the arrow in the Add button and click Add As Link.

    • In the Solution Explorer frame, right click the database file name that has just been added to the project and click Properties.

      In the properties panel, set the Build Action property to Content; set the Copy to Output Directory property to Copy always.

Résultat

An UltraLite database is created.

 See also