Click here to Skip to main content
6,631,889 members and growing! (17,519 online)
Email Password   helpLost your password?
Platforms, Frameworks & Libraries » Mobile Development » Database     Intermediate

A set of ADOCE classes

By Joao Paulo Figueira

Porting Carlos Antollini's ADO classes to the Pocket PC
C++, eVC 3.0, Windows, Win Mobile (PocketPC 2002), Visual Studio, MFC, Dev
Posted:6 Aug 2003
Views:296,125
Bookmarked:33 times
Announcements
Loading...
 
Search    
Advanced Search
Add to IE Search
printPrint   add Share
      Discuss Discuss   Broken Article?Report  
21 votes for this article.
Popularity: 6.29 Rating: 4.76 out of 5

1

2

3
6 votes, 28.6%
4
15 votes, 71.4%
5

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 has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Joao Paulo Figueira


Member
João is a Microsoft Device Application Development MVP and partner at Primeworks, a company that develops remote database access software for Windows Mobile.
Occupation: Software Developer
Company: Primeworks
Location: Portugal Portugal

Other popular Mobile Development articles:

  • Writing Your Own GPS Applications: Part 2
    In part two of the series, the author of "GPS.NET" teaches developers how to write GPS applications suitable for the real world by mastering GPS precision concepts. Source code includes a working NMEA interpreter and sample high-precision application in C# and VB.NET.
  • Writing Your Own GPS Applications: Part I
    What is it that GPS applications need to be good enough to use for in-car navigation? Also, how does the process of interpreting GPS data actually work? In this three-part series, I will cover both topics and give you the skills you need to write a commercial-grade GPS application.
  • Learn How to Find GPS Location on Any SmartPhone, and Then Make it Relevant
    A step by step tutorial for getting GPS from any SmartPhone, even without GPS built in, and then making location useful.
  • iPhone UI in Windows Mobile
    It's an interface that works with transparency effects. As a sample I used an interface just like the iPhone one. In this tutorial I am explaining how simple is working with transparency on Windows Mobile.
  • Pocket 1945 - A C# .NET CF Shooter
    An article on Pocket PC game development
Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 25 of 312 (Total in Forum: 312) (Refresh)FirstPrevNext
GeneralPlease help me to run your sample application PinmemberAllaBry0:20 16 May '07  
GeneralVS 2005 PinmemberAlexEvans11:53 23 Jan '07  
GeneralRe: VS 2005 PinmemberJoão Paulo Figueira23:06 23 Jan '07  
GeneralRe: VS 2005 PinmemberAlexEvans0:04 24 Jan '07  
GeneralRe: VS 2005 PinmemberJoão Paulo Figueira0:35 24 Jan '07  
GeneralRe: VS 2005 PinmemberAlexEvans1:47 24 Jan '07  
GeneralRe: VS 2005 PinmemberJoão Paulo Figueira2:19 24 Jan '07  
GeneralRe: VS 2005 PinmemberAlexEvans10:38 24 Jan '07  
QuestionsqlServer CE 2.0 Open recordset problem Pinmemberarielbiton21:42 30 Dec '06  
AnswerRe: sqlServer CE 2.0 Open recordset problem PinmemberJoão Paulo Figueira0:07 31 Dec '06  
GeneralRe: sqlServer CE 2.0 Open recordset problem Pinmemberarielbiton2:43 31 Dec '06  
GeneralCADORecordset::Execute problem Pinmemberarielbiton5:33 11 Dec '06  
GeneralRecord Exists when try to add new Pinmemberarielbiton0:48 9 Nov '06  
GeneralRe: Record Exists when try to add new PinmemberSonLusia16:48 12 Nov '06  
GeneralRe: Record Exists when try to add new Pinmemberarielbiton0:02 13 Nov '06  
QuestionADOCE filter shows up wrong results! PinmemberClockDivider1:23 24 Aug '06  
GeneralOpen the database PinmemberFerrante De La Grive9:57 26 May '06  
GeneralRe: Open the database PinmemberJoão Paulo Figueira11:06 26 May '06  
GeneralRe: Open the database PinmemberFerrante De La Grive7:53 30 May '06  
GeneralRe: Open the database PinmemberJoão Paulo Figueira22:53 30 May '06  
GeneralBOOL CADODatabase::Execute(LPCTSTR lpstrExec) problem Pinmemberaustion8220:30 23 Mar '06  
GeneralDecimal search problem !! PinmemberJae-Hyu Shin2:07 6 Feb '06  
GeneralRe: Decimal search problem !! PinmemberFerrante De La Grive10:57 20 Jul '06  
GeneralADO Sum, Count(*) PinmemberRam Murugan22:22 17 Jan '06  
GeneralWM5 PinmemberOrkoOrko6:13 6 Jan '06  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin 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