Common CE database questions


Q: Is it possible to use the CEDB APIs (CeMountDBVol, CeOpenDatabaseEx, etc) to open an existing database (.cdb file), and then read records from it?  Or must I use ADOCE?


A: If the database was created using ADOCE, then you should use ADOCE to access it. The CEDB APIs *can* be used to access the database, but the problem is that ADOCE stores additional “meta-data” in the database that you may mess up by doing it that way. Accessing ADOCE databases via the CEDB APIs just breaks an abstraction barrier that might cause you problems.  If the database was not created using ADOCE, then you cannot use ADOCE to access it, because it will be lacking the meta-data that ADOCE needs.  [I wish Microsoft had set forth a convention whereby you could tell the difference between ADOCE CEDB databases and normal CEDB databases.  Alas, everyone started copying the ADOCE convention of using a “.cdb“ extension.]


Q: Can I really access ADOCE databases from eVC++?  The documentation is really lacking and the sample code is confusing.


A: I wish I could help you with your problems using ADOCE, but really my expertise is in the CEDB APIs, not the ADOCE layer wrapped on top of them.  (Sometimes I can make educated guesses about what the ADOCE layer is doing.)  It does seem that a lot less consideration was given to C++ users than VB users when it comes to the ADOCE support and documentation. I do suggest posting questions on newsgroups like microsoft.public.windowsce.app.development or microsoft.public.windowsce.embedded.vc. There are a few knowledgeable newsgroup users out there who answer database questions.


Q: How do I use ADOCE 3.1 with CE 4.x / PocketPC 2003?  I can’t even seem to install it.


A: ADOCE only supports CE 3.0 and earlier, which corresponds to PocketPC and PocketPC 2002.  Older ADOCE applications developed for earlier operating systems should still run on the newer OS, but you cannot use those tools to develop applications for the newer OS.  For CE 4.x and PocketPC 2003, my understanding is that you need to use ADO .NET with Visual Studio .NET 2003.  And make sure to read the next Q/A.


Q: When I use ADO .NET to build database applications for CE 4.x / PocketPC 2003, how do I create a CEDB database?  It only seems to let me use SQL-CE.


A: You can’t.  They (ADO) dropped support for CEDB.  🙁  This means, your only choice for developing ADO applications that use CEDB is to develop using the CE 3.0 / PocketPC / PocketPC 2002 tools (eg. eVC 3.0) with ADOCE.  Your application should work on newer OS versions but you have to use the old tools.  Probably you are just best off switching to SQL-CE.


 

Comments (5)

  1. Peter Foot says:

    Q: Can I really access ADOCE databases from eVC++? The documentation is really lacking and the sample code is confusing.

    You can develop with ADOCE 3.0 and eVC++ 3.0, however from ADOCE 3.1 Microsoft doesn’t support using the control from eVC++ and stopped shipping the header files with the SDKs. If you need to maintain compatibility you can use 3.1 from eVC++ but you’ll need the headers which you can download here:-

    http://www.inthehand.com/downloads/adoce31headers.zip

    The preferred route for native code is to use OleDb and SqlCe from eVC++

    Q: How do I use ADOCE 3.1 with CE 4.x / PocketPC 2003? I can’t even seem to install it.

    You can install the control on CE 4.x / Pocket PC 2003 devices, you will likely also need the eVB runtimes for Pocket PC 2003 also. You can grab ready-made cabs for ADOCE 3.1 here if required:-

    http://www.inthehand.com/downloads/ADOCE31Runtimes.zip

    Q: When I use ADO .NET to build database applications for CE 4.x / PocketPC 2003, how do I create a CEDB database? It only seems to let me use SQL-CE.

    It is possible to access CeDb through a custom wrapper around the ADOCE control. Full details here:-

    http://www.inthehand.com/dotnet/adoce/

    This can help in your transition to full ADO.NET providers since it exposes both the ADOCE model of Connection and Recordset and the ADO.NET model of Connection, Command, DataReader, DataAdapter etc. If you use this approach you’ll be able to make the transition to SqlCe with minimal code changes especially when the SQL Mobile database engine will be built into the next version of Windows Mobile.

    If your data requirements are modest for a .NETCF application you also have the option new to ADO.NET to serialise DataSets to xml files on the device. You can also use the more compressed comma separated values text format for smaller files and better performance using the CsvDataAdapter available at http://www.opennetcf.org

Skip to main content