📄 185-189.html
字号:
<option value="/reference/dir.archive1.html">Free Archive
</SELECT>
</font></td>
</tr>
</table>
</form>
<!-- LEFT NAV SEARCH END -->
</td>
<!-- PUB PARTNERS END -->
<!-- END LEFT NAV -->
<td rowspan="8" align="right" valign="top"><img src="/images/iswbls.gif" width=1 height=400 alt="" border="0"></td>
<td><img src="/images/white.gif" width="5" height="1" alt="" border="0"></td>
<!-- end of ITK left NAV -->
<!-- begin main content -->
<td width="100%" valign="top" align="left">
<!-- END SUB HEADER -->
<!--Begin Content Column -->
<FONT FACE="Arial,Helvetica" SIZE="-1">
To access the contents, click the chapter and section titles.
</FONT>
<P>
<B>Essential Windows CE Application Programming</B>
<FONT SIZE="-1">
<BR>
<I>(Publisher: John Wiley & Sons, Inc.)</I>
<BR>
Author(s): Robert Burdick
<BR>
ISBN: 0471327476
<BR>
Publication Date: 03/01/99
</FONT>
<P>
<form name="Search" method="GET" action="http://search.earthweb.com/search97/search_redir.cgi">
<INPUT TYPE="hidden" NAME="Action" VALUE="Search">
<INPUT TYPE="hidden" NAME="SearchPage" VALUE="http://search.earthweb.com/search97/samples/forms/srchdemo.htm">
<INPUT TYPE="hidden" NAME="Collection" VALUE="ITK">
<INPUT TYPE="hidden" NAME="ResultTemplate" VALUE="itk-simple-intrabook.hts">
<INPUT TYPE="hidden" NAME="ViewTemplate" VALUE="view.hts">
<font face="arial, helvetica" size=2><b>Search this book:</b></font><br>
<INPUT NAME="queryText" size=50 VALUE=""> <input type="submit" name="submitbutton" value="Go!">
<INPUT type=hidden NAME="section_on" VALUE="on">
<INPUT type=hidden NAME="section" VALUE="http://www.itknowledge.com/reference/standard/0471327476/">
</form>
<!-- Empty Reference Subhead -->
<!--ISBN=0471327476//-->
<!--TITLE=Essential Windows CE Application Programming//-->
<!--AUTHOR=Robert Burdick//-->
<!--PUBLISHER=John Wiley & Sons, Inc.//-->
<!--IMPRINT=Wiley Computer Publishing//-->
<!--CHAPTER=7//-->
<!--PAGES=185-189//-->
<!--UNASSIGNED1//-->
<!--UNASSIGNED2//-->
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="../ch06/182-184.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="189-192.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
<P><BR></P>
<H2><A NAME="Heading1"></A><FONT COLOR="#000077">Chapter 7<BR>Windows CE Databases
</FONT></H2>
<P><BIG><BIG>L</BIG></BIG>ong before Microsoft commanded the world of personal computing, another large multinational corporation in a northwestern state far colder and wetter than Washington had its own monopoly on the market for personal information management products. Every time the need arose to record a new phone number, address, or name, or whenever a quick reminder or note had to be jotted down for future reference, millions of people across the country grabbed a pen and wrote this information in (at least in my case) marginally legible handwriting on a one-and-a-half-by-one-inch yellow square piece of sticky paper.</P>
<P>Over time (again in my case, at least), these little pieces of paper were stuck up all over computer monitors, to the inside covers of reference books, kitchen counters, the home office desk; particularly important contacts were even stuck to the back of credit cards in wallets for easy later retrieval. This data storage model naturally led to frequent frantic searches through sock drawers and the front of the refrigerator door for meeting times or important phone numbers. It was somewhat inefficient, but business and our lives managed to move on with few mishaps.</P>
<P>Fortunately, Microsoft and other companies (notably, 3Com Corporation, with its line of PalmPilot organizers) have made all of our lives easier with the introduction of personal information management devices to help keep track of phone numbers, appointments, to-do lists, and the like in one convenient place. At the tap of a stylus on a touch screen, we can now retrieve the phone numbers of friends and coworkers. With a few simple key or stylus strokes, we can tell these devices to alert us days in advance of impending birthdays and anniversaries. The persistent storage capabilities of Windows CE databases make many of these advances possible.</P>
<BLOCKQUOTE>
<P><FONT SIZE="-1"><HR><B>AFTER COMPLETING THIS CHAPTER YOU WILL KNOW HOW TO …</B>
<DL>
<DD><B>Design databases</B>
<DD><B>Create and delete databases</B>
<DD><B>Open and close databases</B>
<DD><B>Add records to and remove them from databases</B>
<DD><B>Read and write database records</B>
<DD><B>Sort databases</B>
<DD><B>Perform database searches</B>
<DD><B>Enumerate databases</B>
<DD><B>Use database notifications</B>
<DD><B>Use the contacts database API</B>
</DL>
<HR></FONT>
</BLOCKQUOTE>
<H3><A NAME="Heading2"></A><FONT COLOR="#000077">The Phone List Application</FONT></H3>
<P>To illustrate the features of Windows CE databases and the Windows CE database application programming interface functions, we will look at the example of a phone list database application. This application maintains a database of employee names, phone numbers, and department numbers. It displays the database contents in a user interface based on a simple list view control, where each list view column represents a particular database record property. The main application window is shown in Figure 7.1.
</P>
<P><A NAME="Fig1"></A><A HREF="javascript:displayWindow('images/07-01.jpg',480,240 )"><IMG SRC="images/07-01t.jpg"></A>
<BR><A HREF="javascript:displayWindow('images/07-01.jpg',480,240)"><FONT COLOR="#000077"><B>Figure 7.1</B></FONT></A> The phone list application.</P>
<P>This application will give you a feel for how to write applications that can add and delete database records, sort a database, and perform database searches. It can also very easily be expanded into a full-fledged contacts or address book application by adding the appropriate properties to the database records. And you can customize the user interface to suit different needs.
</P>
<P>The complete source code for the phone list application can be found on the companion CD in the directory \Samples\dbase. The application that is built by the project files is called DBASE.EXE.</P>
<P><FONT SIZE="+1"><B>Adding and Removing Phone List Database Records</B></FONT></P>
<P>Database entries are added or removed by choosing the appropriate option from the Record menu (Figure 7.2). This menu contains the Add, Delete, and Clear Database options.
</P>
<P><A NAME="Fig2"></A><A HREF="javascript:displayWindow('images/07-02.jpg',480,103 )"><IMG SRC="images/07-02t.jpg"></A>
<BR><A HREF="javascript:displayWindow('images/07-02.jpg',480,103)"><FONT COLOR="#000077"><B>Figure 7.2</B></FONT></A> The phone list application Record menu.</P>
<P>For example, to add a new record to the phone list database, a user selects the Add option from the Record menu. When this menu item is selected, the dialog box shown in Figure 7.3 is displayed. This dialog box allows the user to enter the details of the record to be added to the database. Each text entry field in this dialog corresponds to one of the phone list database record properties.
</P>
<P><A NAME="Fig3"></A><A HREF="javascript:displayWindow('images/07-03.jpg',380,209 )"><IMG SRC="images/07-03t.jpg"></A>
<BR><A HREF="javascript:displayWindow('images/07-03.jpg',380,209)"><FONT COLOR="#000077"><B>Figure 7.3</B></FONT></A> The Add A New Record dialog box.</P>
<P>After all of the properties have been entered, pressing the OK button adds the new record to the phone list database and refreshes the main application window display so that the new record is shown.
</P>
<P>To delete a phone list database record, a user simply needs to select the record to be deleted in the main window and select the Delete option from the Record menu. To delete all database records at once, simply select the Clear Database option from the Record menu.</P>
<P><FONT SIZE="+1"><B>Sorting Phone List Database Records</B></FONT></P>
<P>The phone list application allows users to sort the database by any of the database record properties. Sorting the database by a particular property is done by tapping the column header of the corresponding record property. For example, to sort the database by phone number, the user only needs to tap the phone number column header (Figure 7.4).
</P>
<P><A NAME="Fig4"></A><A HREF="javascript:displayWindow('images/07-04.jpg',480,95 )"><IMG SRC="images/07-04t.jpg"></A>
<BR><A HREF="javascript:displayWindow('images/07-04.jpg',480,95)"><FONT COLOR="#000077"><B>Figure 7.4</B></FONT></A> Sorting the phone list database by phone number.<P><BR></P>
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="../ch06/182-184.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="189-192.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
<!-- all of the reference materials (books) have the footer and subfoot reveresed -->
<!-- reference_subfoot = footer -->
<!-- reference_footer = subfoot -->
<!-- BEGIN SUB FOOTER -->
<br><br>
</TD>
</TR>
</TABLE>
<table width="640" border=0 cellpadding=0 cellspacing=0>
<tr>
<td align="left" width=135><img src="/images/white.gif" width=100 height="1" alt="" border="0"></td>
<!-- END SUB FOOTER -->
<!-- all of the books have the footer and subfoot reveresed -->
<!-- reference_subfoot = footer -->
<!-- reference_footer = subfoot -->
<!-- FOOTER -->
<td width="515" align="left" bgcolor="#FFFFFF">
<font face="arial, helvetica" size="1"><b><a href="/products.html"><font color="#006666">Products</font></a> | <a href="/contactus.html"><font color="#006666">Contact Us</font></a> | <a href="/aboutus.html"><font color="#006666">About Us</font></a> | <a href="http://www.earthweb.com/corporate/privacy.html" target="_blank"><font color="#006666">Privacy</font></a> | <a href="http://www.itmarketer.com/" target="_blank"><font color="#006666">Ad Info</font></a> | <a href="/"><font color="#006666">Home</font></a></b>
<br><br>
Use of this site is subject to certain <a href="/agreement.html">Terms & Conditions</a>, <a href="/copyright.html">Copyright © 1996-1999 EarthWeb Inc.</a><br>
All rights reserved. Reproduction whole or in part in any form or medium without express written permision of EarthWeb is prohibited.</font><p>
</td>
</tr>
</table>
</BODY>
</HTML>
<!-- END FOOTER -->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -