Lesson 2: Create UltraLite database

The following procedure (performed on your desktop PC) creates an UltraLite database using Sybase Central.

See Create a database with the Create Database Wizard.

To create a database
  1. From the Start menu, choose Programs » SQL Anywhere 11 » Sybase Central.

  2. Use the UltraLite plug-in for Sybase Central to create a database in the same directory as your application. In general, the default database characteristics provided by Sybase Central are suitable. Note the following characteristics:

    • Database file name   VBApp.udb or CSApp.udb, depending on your application type.

    • Collation sequence   Use the default collation.

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

    • 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.

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

  4. 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, choose 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 select 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 choose Properties.

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