Click here to Skip to main content
13,354,132 members (60,562 online)
Click here to Skip to main content
Add your own
alternative version


40 bookmarked
Posted 6 Aug 2003

A set of ADOCE classes

, 6 Aug 2003
Rate this:
Please Sign up or sign in to vote.
Porting Carlos Antollini's ADO classes to the Pocket PC.

Sample Image - ado_ce_ca.jpg


One of the questions I have seen most frequently asked in Pocket PC development groups, is how to develop in eVC using ADOCE and Pocket Access. There are some resources on the web for this, but it is hard to find a freely available set of C++ classes that will encapsulate ADOCE 3.1 in complete fashion. After looking in CP, I found a very good candidate.

This article presents a port of Carlos Antollini's popular ADO classes to the Pocket PC. Carlos' article (A set of ADO Classes - version 2.07) presents a fairly thorough coverage of desktop ADO and was selected for porting because it is freely available and it is very popular.

The port

The Pocket PC uses ADOCE 3.1, a cut-down version of the ADO implementation found on desktop computers. The ADOCE 3.1 object model is smaller in both number of objects and methods. Nevertheless, it is quite usable for most database applications, retaining its ease of use.

Source compatibility

One of the objectives of this port was to keep source compatibility. Hence, you will be able to compile the source files (ado.h and ado.cpp) in both platforms: Desktop and Pocket PC. The source compatibility was achieved using precompiler directives, which may render some parts of the code harder to read.

What's missing?

Of all of Carlos' classes, the Pocket PC will only see CADODatabase and CADORecordset. In fact, these are the only classes that have direct ADOCE support. Also, not all of the classes' methods are supported and have been removed. Here is a list of the unsupported methods:

  • void CADODatabase::dump_com_error(_com_error &e);
  • BOOL CADORecordset::AddNew(CADORecordBinding &pAdoRecordBinding);
  • BOOL CADORecordset::RecordBinding(CADORecordBinding &pAdoRecordBinding);
  • CString CADORecordset::GetString(LPCTSTR lpCols, LPCTSTR lpRows, LPCTSTR lpNull, long numRows = 0);

Also, there are missing items in the CADORecordset::cadoDataType enumeration.

What's new?

During the port I had to add some missing functionalities, the most important of which is UNICODE support.

During the first debugging session I also found that CADORecordset::Open needed a new mode (openUpdate) to allow for correct use of the Update method (see sample code for an example).

Porting warnings

Check that the #import directive in ado.h is correct for your development environment.

The port has not been thoroughly tested. Please help me with this ongoing process.

Using Pocket Access

Pocket Access is a very simple database manager. It is so simple that it will not support the following (among other) desktop features:

  • Unique indexes
  • Referential integrity
  • Advanced SQL statements (almost everything is missing)
  • Autonum fields

You also have some limitations to note:

  • Maximum number of 4 indexes per table
  • Maximum of 4 tables per JOIN
  • You only get INNER JOINs

So why use it? It is very simple to setup and synchronize with your desktop environment, and you don't have to pay licensing fees.

Using ADOCE to manage your tables may be trickier than you thought, so I prepared a simple demo application that manages (does not delete - yet) a list of authors of this section. The bulk of the work is in CChildView, a CListCtrl-derived class, where records are created and modified. Please do note the peculiarities of adding new records and updating an existing record.

Sample application

The sample application is provided with full source code and with two versions of the database: desktop (.mdb) and Pocket PC (.cdb). You can create the second from the first, by using ActiveSync. If you only have an emulator to play with, you can copy the .cdb file directly into the \My Documents folder.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

João Paulo Figueira
Software Developer (Senior) Frotcom International
Portugal Portugal
I work on R&D for Frotcom International, a company that develops web-based fleet management solutions.

You may also be interested in...

Comments and Discussions

GeneralRe: evc++4 & SQLCE, cannot execute DELETE or INSERT Pin
smoitryrbs17-Jun-05 4:13
membersmoitryrbs17-Jun-05 4:13 
GeneraldbDouble and select Pin
davidoff3-Jun-05 12:50
memberdavidoff3-Jun-05 12:50 
GeneralAccess Error Pin
ValDog2-Jun-05 8:23
memberValDog2-Jun-05 8:23 
GeneralCannot open database in evc4 + ppc2003 Pin
Danny Kao10-May-05 17:25
sussDanny Kao10-May-05 17:25 
GeneralRe: Cannot open database in evc4 + ppc2003 Pin
João Paulo Figueira10-May-05 23:03
memberJoão Paulo Figueira10-May-05 23:03 
GeneralRe: Cannot open database in evc4 + ppc2003 Pin
Danny Kao10-May-05 23:19
sussDanny Kao10-May-05 23:19 
GeneralRe: Cannot open database in evc4 + ppc2003 Pin
Danny Kao11-May-05 21:13
sussDanny Kao11-May-05 21:13 
GeneralSlow in Update Pin
emranallan14-Apr-05 1:34
memberemranallan14-Apr-05 1:34 
I have a database contains from 300 to 500 records per each table.
I m using EVC4, with ADOCE for access the cdb database,the application is fast with query operations, but when I want to update a record, it take long time.
I tried to use cursor, but I got the same result.
hope to find a solution here

sorry for my english.
GeneralSql server CE always failed Pin
Vincent Richomme11-Apr-05 3:21
memberVincent Richomme11-Apr-05 3:21 
GeneralRe: Sql server CE always failed Pin
João Paulo Figueira11-Apr-05 3:43
memberJoão Paulo Figueira11-Apr-05 3:43 
GeneralRe: Sql server CE always failed Pin
Vincent Richomme12-Apr-05 9:06
memberVincent Richomme12-Apr-05 9:06 
GeneralRe: Sql server CE always failed Pin
João Paulo Figueira12-Apr-05 11:32
memberJoão Paulo Figueira12-Apr-05 11:32 
GeneralRe: Sql server CE always failed Pin
frognose23-Apr-05 22:21
memberfrognose23-Apr-05 22:21 
GeneralWhere I can find this file "adoce31.tlb" Pin
raisingrain5-Apr-05 0:31
memberraisingrain5-Apr-05 0:31 
GeneralRe: Where I can find this file "adoce31.tlb" Pin
João Paulo Figueira5-Apr-05 0:51
memberJoão Paulo Figueira5-Apr-05 0:51 
GeneralFailed to release the memory after delete the record set Pin
Anonymous3-Apr-05 3:39
sussAnonymous3-Apr-05 3:39 
Generaladoce30.tlb Pin
Vincent Richomme29-Mar-05 11:02
memberVincent Richomme29-Mar-05 11:02 
GeneralRe: adoce30.tlb Pin
Vincent Richomme29-Mar-05 11:04
memberVincent Richomme29-Mar-05 11:04 
GeneralRe: adoce30.tlb Pin
raisingrain5-Apr-05 0:36
memberraisingrain5-Apr-05 0:36 
GeneralLook this warning Pin
Bondezan26-Mar-05 12:11
memberBondezan26-Mar-05 12:11 
GeneralRe: Look this warning Pin
João Paulo Figueira27-Mar-05 9:22
memberJoão Paulo Figueira27-Mar-05 9:22 
GeneralHelp! - Includes Pin
whatever87617-Mar-05 16:53
susswhatever87617-Mar-05 16:53 
Generaldatabase connection Pin
@LX15-Mar-05 10:10
member@LX15-Mar-05 10:10 
GeneralRe: database connection Pin
João Paulo Figueira15-Mar-05 10:49
memberJoão Paulo Figueira15-Mar-05 10:49 
Generalsql command supported in adoce 3.1 Pin
riki_risnandar31-Jan-05 17:25
memberriki_risnandar31-Jan-05 17:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.180111.1 | Last Updated 7 Aug 2003
Article Copyright 2003 by João Paulo Figueira
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid