Writing a database application for PDAs
Published: 30 Aug 2002 15:47 BST
As handheld computers continue to make inroads into the corporate world, development shops must tailor their applications to meet the needs of the new devices. One of the biggest challenges will be building databases for these mobile units. In this article, I will provide the necessary foundation for writing a database application that resides on a Windows CE device.
The Database API
Windows CE has supported a proprietary Database API since Windows CE 1.0. In Windows CE 2.1, Microsoft introduced a set of duplicate functions with the extension Ex that offered some additional features. The primary change involved the database's not being exclusively in the object store but optionally on the file system or perhaps on a Compact Flash card.
However, you have to realise the limitations of the Database API. It supports only one level of hierarchy, which means that tables can't appear underneath other tables. You can't reference one table based on the value of an element from another table, either, and the databases can't share records. Every record has a unique ID and can be contained in only one database. If you can't develop your application given these limitations, I suggest that you move toward a more full-fledged database, such as Pocket Access or SQL Server for CE.
Prior to Windows CE 3.0, the database API was limited to four indices for sorting. This was bumped to eight after the release of Windows CE 3.0. With eight indices available, the database API becomes a perfect candidate for storing a collection of objects that needs to be compatible across a wide variety of Windows CE platforms and versions. For example, Microsoft uses the database API to store the contact lists, the e-mail, and the task list in Pocket PC/Pocket PC 2002.
ADOCE
ADOCE, Microsoft's trimmed-down version of ActiveX Data Objects (ADO), is part of the Microsoft Universal Data Access (UDA) strategy. ADO is an ActiveX-packaged front end for OLEDB that is a generic interface to many databases. The programmer can use ADOCE to store information in the object store, using Pocket Access or with Microsoft's SQL Server 2000 Windows CE edition.
ADO and ADOCE have the Connection and Recordset object in common. ADOCE removed some of the redundant methods of creating and connecting to a database, and the database providers have shrunk. ADOCE is also missing the Property object, persistence of the Recordset object, and asynchronous queries.
Apart from these issues, the process of opening a database in ADO vs. ADOCE is similar, including such aspects as updating the database and adding and deleting records.








