MobileVB and UltraLite
The second option, AppForge Mobile VB, allows a single application to be built in Visual Basic; however, that app can also be compiled and deployed to Palm OS devices. More information on AppForge Mobile VB can be found in an earlier article I wrote for InformIT; for now, I will discuss how Mobile VB can be used to access an UltraLite database. SQL Anywhere Studio 8 includes a MobileVB UltraLite "ingot" (AppForge nomenclature for a component that can be accessed from Visual Basic code). This ingot is ulingot8.dll for Windows CE devices and ulingot8.prc for Palm OS devices. These files are included in the \Program Files\Sybase\SQL Anywhere 8\ultralite\UltraLiteForMobileVB directory (if you selected the default installation location of your Program Files directory).
The MobileVB UltraLite API bears much more resemblance to the Java API we discussed in article 2 of this tutorial than it does to Microsoft's ADO library. All the same objects used by the Java API are in place now in Visual Basic syntax, including ULDatabaseManager, ULConnection, and ULTable. Because MobileVB UltraLite can be deployed to three separate platforms (Win32, Palm, and WinCE), it is necessary to specify the locations of the database on each platform because all three operating systems' file systems differ. A sample connection string that is designed to work on all three operating systems might look like this:
Dim dbLocation As String dbLocation = "dbf=c:\mobile_sales mobile_sales.udb;palm_db=mobsales;ce_file= Program Files\Mobile Sales\mobile_sales.udb;"
A similar exercise has to be done in order to build the location of the schema file, so the UltraLite database can be built correctly the first time the application is run (more information on this in article 2 of this tutorial!).
Dim schemaLocation As String schemaLocation = "schema_file=c:\mobile_sales mobile_sales.usm;palm_schema=mobile_sales.usm;ce_schema= Program Files\Mobile Sales\mobile_sales.usm"
Both property listings are then combined and passed to the ULDatabaseManager.CreateDatabase() method when the application starts up. This method, if successful, returns a ULConnection object. This object can then be used (just like the corresponding Java object discussed in article 2) to retrieve the contents of tables. As was discussed with the Java UltraLite APIs, the MobileVB ingots for UltraLite comprise only very basic data access functionality. If you're interested in doing more with your mobile database, you'll be forced to either limit your platform support by going with Microsoft's eMbedded Visual Tools, going with Java, or accessing the C language OLE DB interface to ASA through MobileVB.