![]() |
Platforms, Frameworks & Libraries »
Mobile Development »
Database
Intermediate
A set of ADOCE classesBy Joao Paulo FigueiraPorting Carlos Antollini's ADO classes to the Pocket PC |
C++, eVC 3.0, Windows, Win Mobile (PocketPC 2002), Visual Studio, MFC, Dev
|
|
Advanced Search Add to IE Search |
|
|
|
||||||||||||||||

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 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.
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.
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.
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).
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.
Pocket Access is a very simple database manager. It is so simple that it will not support the following (among other) desktop features:
Autonum fieldsYou also have some limitations to note:
JOIN
INNER JOINsSo 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.
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.
General
News
Question
Answer
Joke
Rant
Admin
|
PermaLink |
Privacy |
Terms of Use
Last Updated: 6 Aug 2003 Editor: Smitha Vijayan |
Copyright 2003 by Joao Paulo Figueira Everything else Copyright © CodeProject, 1999-2009 Web21 | Advertise on the Code Project |