Click here to Skip to main content
15,881,812 members
Articles / Mobile Apps / Windows Mobile

A set of ADOCE classes

Rate me:
Please Sign up or sign in to vote.
4.78/5 (21 votes)
6 Aug 2003CPOL3 min read 550.8K   1.2K   40   312
Porting Carlos Antollini's ADO classes to the Pocket PC.

Sample Image - ado_ce_ca.jpg

Introduction

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.

License

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


Written By
Software Developer (Senior) Frotcom International
Portugal Portugal
I work on R&D for Frotcom International, a company that develops web-based fleet management solutions.

Comments and Discussions

 
GeneralRe: A Simple ADOCE problem!!!!!!!!!!!!!!!!!! Pin
Willaim Cheng2-Dec-05 22:58
Willaim Cheng2-Dec-05 22:58 
GeneralRe: A Simple ADOCE problem!!!!!!!!!!!!!!!!!! Pin
Willaim Cheng3-Dec-05 21:00
Willaim Cheng3-Dec-05 21:00 
QuestionHelp... Please! I am desperate! Pin
Willem Le Roux18-Nov-05 1:00
Willem Le Roux18-Nov-05 1:00 
QuestionWindows Mobile 5.0 broken? Pin
ajhuddy4-Nov-05 5:04
ajhuddy4-Nov-05 5:04 
AnswerRe: Windows Mobile 5.0 broken? Pin
João Paulo Figueira4-Nov-05 5:10
professionalJoão Paulo Figueira4-Nov-05 5:10 
GeneralRe: Windows Mobile 5.0 broken? Pin
ajhuddy4-Nov-05 9:41
ajhuddy4-Nov-05 9:41 
GeneralRe: Windows Mobile 5.0 broken? Pin
João Paulo Figueira4-Nov-05 11:00
professionalJoão Paulo Figueira4-Nov-05 11:00 
GeneralI am using these classes in Mobile 5 ~ [modified] Pin
papilion19-Jul-06 20:34
papilion19-Jul-06 20:34 
Wow.. I found how can use these classes in Mobile 5.
I sorry, Just I found that with SQL-Ce 2.0,

first install files concerned with Sql-Ce 2.0.
and install ADOCE31.sa.CAB file in Mobile5-device.

then.. you can use these classes. !!

Hukk,, everybody Knew that? ^^;

I am sorry for my poor english ~





have a good day everybody ^^

-- modified at 2:34 Thursday 20th July, 2006
QuestionCan adoce classes link with oracle? Pin
sorrowxiao10-Oct-05 17:45
sorrowxiao10-Oct-05 17:45 
GeneralCompiling Error !!! Pin
chanwoopark7-Sep-05 4:34
chanwoopark7-Sep-05 4:34 
GeneralCADODatabase.Open doen't run Pin
bjzhq6-Sep-05 23:00
bjzhq6-Sep-05 23:00 
GeneralRe: CADODatabase.Open doen't run Pin
João Paulo Figueira6-Sep-05 23:23
professionalJoão Paulo Figueira6-Sep-05 23:23 
GeneralRe: CADODatabase.Open doen't run Pin
Anonymous8-Sep-05 16:30
Anonymous8-Sep-05 16:30 
QuestionI have the same error with you!!!!! Pin
sorrowxiao10-Oct-05 17:25
sorrowxiao10-Oct-05 17:25 
QuestionHow do i change it ? Pin
Victor Decruz27-Aug-05 18:38
Victor Decruz27-Aug-05 18:38 
GeneralProblem with evc4sp4 Pin
MFDonadeli14-Jul-05 0:54
sussMFDonadeli14-Jul-05 0:54 
Generalevc++4 & SQLCE, cannot execute DELETE or INSERT Pin
smoitryrbs17-Jun-05 0:51
smoitryrbs17-Jun-05 0:51 
GeneralRe: evc++4 & SQLCE, cannot execute DELETE or INSERT Pin
João Paulo Figueira17-Jun-05 1:22
professionalJoão Paulo Figueira17-Jun-05 1:22 
GeneralRe: evc++4 & SQLCE, cannot execute DELETE or INSERT Pin
smoitryrbs17-Jun-05 2:48
smoitryrbs17-Jun-05 2:48 
GeneralRe: evc++4 & SQLCE, cannot execute DELETE or INSERT Pin
João Paulo Figueira17-Jun-05 2:52
professionalJoão Paulo Figueira17-Jun-05 2:52 
GeneralRe: evc++4 & SQLCE, cannot execute DELETE or INSERT Pin
smoitryrbs17-Jun-05 2:56
smoitryrbs17-Jun-05 2:56 
GeneralRe: evc++4 & SQLCE, cannot execute DELETE or INSERT Pin
João Paulo Figueira17-Jun-05 3:11
professionalJoão Paulo Figueira17-Jun-05 3:11 
GeneralRe: evc++4 & SQLCE, cannot execute DELETE or INSERT Pin
smoitryrbs17-Jun-05 3:13
smoitryrbs17-Jun-05 3:13 
GeneraldbDouble and select Pin
davidoff3-Jun-05 11:50
davidoff3-Jun-05 11:50 
GeneralAccess Error Pin
ValDog2-Jun-05 7:23
ValDog2-Jun-05 7:23 

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.