ZDNet UK


Skip to Main Content

ZDNet.co.uk - Winner of Best Business Website 2007
  1. Home
  2. News
  3. Blogs
  4. Reviews
  5. Jobs
  6. Resources
  7. Community
  8. My ZDNet

 

ZDNet UK RSS Feeds


Office applications Toolkit

Writing a database application for PDAs

Khalid Shaikh. Builder.com Builder.com

Published: 30 Aug 2002 15:47 BST

  • Email
  • Trackback
  • Clip Link
  • Print friendly
  • Post Comment

The CeWriteRecordProps function adds a record to the database, as shown in the following code snippet:

CEOID CeWriteRecordProps(
HANDLE hDbase,
CEOID oidRecord,
WORD cPropID,
CEPROPVAL * rgPropVal );

You need to fill the CEPROPVAL structure with the properties that its table is going to contain. This is akin to assigning data types to columns in a standard Access or SQL database. Table A outlines the legal data types.

Value Description
CEVT_BLOB A CEBLOB structure
CEVT_BOOL A Boolean value
CEVT_FILETIME A FILETIME structure
CEVT_12 A 16-bit signed integer
CEVT_14 A 32-bit signed integer
CEVT_LPWSTR A null-terminated string
CEVT_R8 A 64-bit signed integer
CEVT_UI2 A 16-bit unsigned integer
CEVT_UI4 A 32-bit unsigned integer

Our application stores the following properties in the CEDB database as shown in the following list:

  • strTitle--256-character Unicode string
  • nHour--short int
  • nMinute--short int
  • nRating--float
  • strDescription--1,024-character Unicode string

Reading from the database

You must take care to set the "Seek" of the database to the right position before reading. The Overview tab enumerates all the records in the database from start to finish whenever that Overview property page receives focus.

The CeReadRecordPropsEx requires a handle to the database and a buffer to dump all the contents of the record into. CeReadRecordPropsEx can even allocate an appropriate amount of RAM on the heap, which you have to free after the function call. There is no need to respecify the CEPROPVAL.

CEOID CeReadRecordPropsEx (
HANDLE hDbase,
DWORD dwFlags,
LPWORD lpcPropID,
CEPROPID * rgPropID,
LPBYTE * lplpBuffer,
LPDWORD lpcbBuffer,
HANDLE hHeap );

Closing the database

You close the database by unmounting the volume that the database is located on. The function CeUnmountDBVol helps accomplish that, as shown in the following code:

BOOL CeUnmountDBVol (
PCEGUID pceguid );

Conclusion

You now have the foundation and code to write a simple, quick database application using Windows CE. In the next installment, I will cover an ADOCE client application that hits SQL Server via a wireless connection located on a corporate backbone.


Have your say instantly, in the Tech Update forum.

For a weekly round-up of the enterprise IT news, sign up for the Tech Update newsletter.

Find out what's where in the new Tech Update with our Guided Tour.

Tell us what you think in the Mailroom.

Next

Previous

1 2 3 4


  • Email
  • Trackback
  • Clip Link
  • Print friendlyPrint with Konica

Did you find this article useful?
26 out of 58 people found this useful


Full Talkback thread

0 comments

Company/Topic Alerts

Create a new alert from the list below:








Featured Talkback

In association with Intel
Why do so many (virtually all) software packages think that they are so important that they have to be started automatically every time the computer boots? What is the largest number of "speed access", "update check", "camera download" and whatever other background programs you have ever seen running? Of those, how many did you really need?

By: J.A. Watson

Read full story:
Annoying software: a rogues' gallery

Discussions

razer razer

There is difference

Thursday 16 October 2008, 1:40 AM

5 comments
1000215420 1000215420

Everything can be counterfeited

Wednesday 15 October 2008, 10:55 PM

3 comments
1000215420 1000215420

Not live but right to reside

Wednesday 15 October 2008, 10:48 PM

5 comments

Vista Upgrade Blog

Vista - Still Running and Stable After...

Six weeks ago, when I wrote Renewed Adventures with Vista, I wondered if Microsoft had finally managed to fix it sufficiently that I wouldn't be forced to give up on it after a few... More

Post a comment

Official MS Windows 7 Bloggers

Check this out: http://blogs.msdn.com/e7...spx Its an official blog "Engineering Windows 7" Nothing. That's what is revealed. Until there is real... More

5 comments

Microsoft's Mojave just a desert vista

It didn't seem fair to wade into Microsoft's “Mojave Experiment” advert quite so soon after the flat earth incident. But The Economist has no such qualms: in this week's issue, it wonders... More

6 comments