亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? ch22.htm

?? Learning language of Visual C++6
?? HTM
?? 第 1 頁 / 共 4 頁
字號:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>

<HEAD>
<SCRIPT LANGUAGE="JavaScript">

<!--

function popUp(pPage) {
 var fullURL = document.location;
 var textURL = fullURL.toString();
 var URLlen = textURL.length;
 var lenMinusPage = textURL.lastIndexOf("/");
 lenMinusPage += 1;
 var fullPath = textURL.substring(0,lenMinusPage);
 popUpWin = window.open('','popWin','resizable=yes,scrollbars=no,width=525,height=394');
 figDoc= popUpWin.document;
 zhtm= '<HTML><HEAD><TITLE>' + pPage + '</TITLE>';
 zhtm += '<link rel="stylesheet" href="/includes/stylesheets/ebooks.css"></head>';
 zhtm += '<BODY bgcolor="#FFFFFF">';
 zhtm += '<IMG SRC="' + fullPath + pPage + '">';
 zhtm += '<P><B>' + pPage + '</B>';
 zhtm += '</BODY></HTML>';
 window.popUpWin.document.write(zhtm);
 window.popUpWin.document.close();
 // Johnny Jackson 4/28/98
 }

//-->
                                                                
</SCRIPT>
<link rel="stylesheet" href="/includes/stylesheets/ebooks.css">

	
	<TITLE>Special Edition Using Visual C++ 6 -- Ch 22 -- Database Access</TITLE>
</HEAD>

<BODY TEXT="#000000" BGCOLOR="#FFFFFF">

<CENTER>
<H1><IMG SRC="../button/que.gif" WIDTH="171" HEIGHT="66" ALIGN="BOTTOM" BORDER="0"><BR>
Special Edition Using Visual C++ 6</H1>
</CENTER>
<CENTER>
<P><A HREF="../ch21/ch21.htm"><IMG SRC="../button/previous.gif" WIDTH="128" HEIGHT="28"
ALIGN="BOTTOM" ALT="Previous chapter" BORDER="0"></A><A HREF="../ch23/ch23.htm"><IMG
SRC="../button/next.gif" WIDTH="128" HEIGHT="28" ALIGN="BOTTOM" ALT="Next chapter"
BORDER="0"></A><A HREF="../index.htm"><IMG SRC="../button/contents.gif" WIDTH="128"
HEIGHT="28" ALIGN="BOTTOM" ALT="Contents" BORDER="0"></A> 
<HR>

</CENTER>
<CENTER>
<H1>- 22 -</H1>
</CENTER>
<CENTER>
<H1>Database Access</H1>
</CENTER>

<UL>
	<LI><A HREF="#Heading1">Understanding Database Concepts</A>
	<UL>
		<LI><A HREF="#Heading2">Using the Flat Database Model</A>
		<LI><A HREF="#Heading3">Using the Relational Database Model</A>
		<LI><A HREF="#Heading4">Accessing a Database</A>
		<LI><A HREF="#Heading5">The Visual C++ ODBC Classes</A>
	</UL>
	<LI><A HREF="#Heading6">Creating an ODBC Database Program</A>
	<UL>
		<LI><A HREF="#Heading7">Registering the Database</A>
		<LI><A HREF="#Heading8">Creating the Basic Employee Application</A>
		<LI><A HREF="#Heading9">Creating the Database Display</A>
		<LI><A HREF="#Heading10">Adding and Deleting Records</A>
		<LI><A HREF="#Heading11">Examining the OnRecordAdd() Function</A>
		<LI><A HREF="#Heading12">Examining the OnMove() Function</A>
		<LI><A HREF="#Heading13">Examining the OnRecordDelete() Function</A>
		<LI><A HREF="#Heading14">Sorting and Filtering</A>
		<LI><A HREF="#Heading15">Examining the OnSortDept() Function</A>
		<LI><A HREF="#Heading16">Examining the DoFilter() Function</A>
	</UL>
	<LI><A HREF="#Heading17">Choosing Between ODBC and DAO</A>
	<LI><A HREF="#Heading18">OLE DB</A>
</UL>

<P>
<HR SIZE="4">

<CENTER>
<H1></H1>
</CENTER>
<P>Without a doubt, databases are one of the most popular computer applications.
Virtually every business uses databases to keep track of everything from its customer
list to the company payroll. Unfortunately, there are many different types of database
applications, each of which defines its own file layouts and rules. In the past,
programming database applications was a nightmare because it was up to the programmer
to figure out all the intricacies of accessing the different types of database files.
As a Visual C++ developer, you have a somewhat simpler task because MFC includes
classes built on the ODBC (Open Database Connectivity) and DAO (Data Access Objects)
systems. Other Microsoft database technologies are gaining MFC support as well.</P>
<P>Believe it or not, by using AppWizard, you can create a simple database program
without writing even a single line of C++ code. More complex tasks do require some
programming, but not as much as you might think.</P>
<P>This chapter gives you an introduction to programming with Visual C++'s ODBC classes.
You will also learn about the similarities and differences between ODBC and DAO.
Along the way, you will create a database application that can not only display records
in a database but also update, add, delete, sort, and filter records.</P>
<P>
<H2><A NAME="Heading1"></A>Understanding Database Concepts</H2>
<P>Before you can write database applications, you have to know a little about how
databases work. Databases have come a long way since their invention, so there's
much you can learn about them. This section provides a quick introduction to basic
database concepts, including the two main types of databases: flat and relational.</P>
<P>
<H3><A NAME="Heading2"></A>Using the Flat Database Model</H3>
<P>Simply put, a <I>database</I> is a collection of records. Each record in the database
is composed of fields, and each field contains information related to that specific
record. For example, suppose you have an address database. In this database, you
have one record for each person. Each record contains six fields: the person's name,
street address, city, state, zip code, and phone number. A single record in your
database might look like this:</P>
<P>
<PRE>NAME: Ronald Wilson
STREET: 16 Tolland Dr.
CITY: Hartford
STATE: CT
ZIP: 06084
PHONE: 860-555-3542
</PRE>
<P>Your entire database will contain many records like this one, with each record
containing information about a different person. To find a person's address or phone
number, you search for the name. When you find the name, you also find all the information
that's included in the record with the name.</P>
<P>This type of database system uses the <I>flat database model</I>. For home use
or for small businesses, the simple flat database model can be a powerful tool. However,
for large databases that must track dozens, or even hundreds, of fields of data,
a flat database can lead to repetition and wasted space. Suppose you run a large
department store and want to track some information about your employees, including
their name, department, manager's name, and so on. If you have 10 people in Sporting
Goods, the name of the Sporting Goods manager is repeated in each of those 10 records.
When Sporting Goods hires a new manager, all 10 records have to be updated. It would
be much simpler if each employee record could be <I>related</I> to another database
of departments and manager names.</P>
<P>
<H3><A NAME="Heading3"></A>Using the Relational Database Model</H3>
<P>A <I>relational database</I> is like several flat databases linked together. Using
a relational database, you can not only search for individual records, as you can
with a flat database but also relate one set of records to another. This enables
you to store data much more efficiently. Each set of records in a relational database
is called a <I>table</I>. The links are accomplished through <I>keys</I>, values
that define a record. (For example, the employee ID might be the key to an employee
table.)</P>
<P>The sample relational database that you use in this chapter was created using
Microsoft Access. The database is a simple system for tracking employees, managers,
and the departments for which they work. Figures 22.1, 22.2, and 22.3 show the tables:
The Employees table contains information about each store employee, the Managers
table contains information about each store department's manager, and the Departments
table contains information about the departments themselves. (This database is very
simple and probably not usable in the real world.)</P>
<P><A HREF="javascript:popUp('22uvc01.gif')"><B>FIG. 22.1</B></A><B> </B><I>The Employees
table contains data fields for each store employee.</I></P>
<P><A HREF="javascript:popUp('22uvc02.gif')"><B>FIG. 22.2</B></A><B> </B><I>The Managers
table contains information about each store department's manager.</I></P>
<P><A HREF="javascript:popUp('22uvc03.gif')"><B>FIG. 22.3</B></A><B> </B><I>The Departments
table contains data about each store department.</I></P>
<H3><I></I></H3>
<H3><A NAME="Heading4"></A>Accessing a Database</H3>
<P>Relational databases are accessed by using some sort of database scripting language.
The most commonly used database language is the Structured Query Language (SQL),
which is used to manage not only databases on desktop computers but also huge databases
used by banks, schools, corporations, and other institutions with sophisticated database
needs. By using a language such as SQL, you can compare information in the various
tables of a relational database and extract results made up of data fields from one
or more tables combined.</P>


<BLOCKQUOTE>
	<P>
<HR>
<strong>TIP:</strong> Most developers pronounce SQL as <I>Sequel</I>. 
<HR>


</BLOCKQUOTE>

<P>Learning SQL, though, is a large task, one that is beyond the scope of this book
(let alone this chapter). In fact, entire college-level courses are taught on the
design, implementation, and manipulation of databases. Because there isn't space
in this chapter to cover relational databases in any useful way, you will use the
Employee table (refer to Figure 22.1) of the Department Store database in the sample
database program you will soon develop. When you finish creating the application,
you will have learned one way to update the tables of a relational database without
knowing even a word of SQL. (Those of you who live and breathe SQL will enjoy Chapter
23, &quot;SQL and the Enterprise Edition.&quot;)</P>
<P>
<H3><A NAME="Heading5"></A>The Visual C++ ODBC Classes</H3>
<P>When you create a database program with Visual C++'s AppWizard, you end up with
an application that draws extensively on the various ODBC classes that have been
incorporated into MFC. The most important of these classes are CDatabase, CRecordset,
and CRecordView.</P>
<P>AppWizard automatically generates the code needed to create an object of the CDatabase
class. This object represents the connection between your application and the data
source that you will be accessing. In most cases, using the CDatabase class in an
AppWizard-generated program is transparent to you, the programmer. All the details
are handled by the framework.</P>
<P>AppWizard also generates the code needed to create a CRecordset object for the
application. The CRecordset object represents the actual data currently selected
from the data source, and its member functions manipulate the data from the database.</P>
<P>Finally, the CRecordView object in your database program takes the place of the
normal view window you're accustomed to using in AppWizard-generated applications.
A CRecordView window is like a dialog box that's being used as the application's
display. This dialog box-type of window retains a connection to the application's
CRecordset object, hustling data back and forth between the program, the window's
controls, and the recordset. When you first create a new database application with
AppWizard, it's up to you to add edit controls to the CRecordView window. These edit
controls must be bound to the database fields they represent so that the application
framework knows where to display the data you want to view.</P>
<P>In the next section, you will see how these various database classes fit together
as you build the Employee application step by step.</P>
<P>
<H2><A NAME="Heading6"></A>Creating an ODBC Database Program</H2>
<P>Although creating a simple ODBC database program is easy with Visual C++, there
are a number of steps you must complete:</P>

<DL>
	<DT></DT>
	<DD><B>1. </B>Register the database with the system.
	<P>
	<DT></DT>
	<DD><B>2. </B>Use AppWizard to create the basic database application.
	<P>
	<DT></DT>
	<DD><B>3. </B>Add code to the basic application to implement features not automatically
	supported by AppWizard.
	<P>
</DL>

<P>In the following sections, you will see how to perform these steps as you create
the Employee application, which enables you to add, delete, update, sort, and view
records in the Employees table of the sample Department Store database.</P>
<P>
<H3><A NAME="Heading7"></A>Registering the Database</H3>
<P>Before you can create a database application, you must register the database that
you want to access as a data source that you can access through the ODBC driver.
Follow these steps to accomplish this important task:</P>

<DL>
	<DT></DT>
	<DD><B>1. </B>Create a folder called <B>Database</B> on your hard disk and copy the
	file named DeptStore.mdb from this book's Web site to the new Database folder. If
	you don't have Web access, you can type the three tables into Microsoft Access. If
	you don't have Access, you can use a different database program, but you will have
	to connect to the data source for that program.
	<P>
	<DT></DT>
	<DD>The DeptStore.mdb file is a database created with Microsoft Access. You will
	use this database as the data source for the Employee application.
	<P>
	<DT></DT>
	<DD><B>2. </B>From the Windows Start menu, click Settings and then Control Panel.
	When the Control Panel dialog appears, double-click the 32-Bit ODBC icon. The ODBC
	Data Source Administrator dialog box appears, as shown in Figure 22.4.
	<P>
</DL>

<P><A HREF="javascript:popUp('22uvc04.gif')"><B>FIG. 22.4</B></A><B> </B><I>Connecting
a data source to your application starts with the ODBC Data Source Administrator.</I></P>
<P>

<DL>
	<DT><I></I></DT>
	<DD><B>3. </B>Click the Add button. The Create New Data Source dialog box appears.
	Select the Microsoft Access Driver from the list of drivers, as shown in Figure 22.5,
	and click Finish.
	<P>
	<DT></DT>
	<DD>The Microsoft Access Driver is now the ODBC driver that will be associated with
	the data source you create for the Employee application.
	<P>
</DL>

<P><A HREF="javascript:popUp('22uvc05.gif')"><B>FIG. 22.5</B></A><B> </B><I>Creating
a new data source is as simple as choosing Access from a list of drivers.</I></P>
<P>

<DL>
	<DT><I></I></DT>
	<DD><B>4. </B>When the ODBC Microsoft Access 97 Setup dialog box appears, enter <B>Department
	Store</B> in the Data Source Name text box and <B>Department Store Sample</B> in
	the Description text box, as shown in Figure 22.6.
	<P>
	<DT></DT>
	<DD>The Data Source Name is a way of identifying the specific data source you're
	creating. The Description field enables you to include more specific information
	about the data source.
	<P>
</DL>

<P><A HREF="javascript:popUp('22uvc06.gif')"><B>FIG. 22.6</B></A><B> </B><I>Name
your data source whatever you like.</I></P>
<P>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产一区二区看久久| 美国十次综合导航| 精品久久久久香蕉网| 9色porny自拍视频一区二区| 丝袜美腿成人在线| 亚洲免费在线看| 久久久久久日产精品| 欧美久久高跟鞋激| 91在线观看一区二区| 国产精品一区二区三区四区 | 欧美日韩精品欧美日韩精品一| 国产呦萝稀缺另类资源| 亚洲福利一区二区| 国产精品高潮久久久久无| 精品久久久久久久人人人人传媒| 91久久香蕉国产日韩欧美9色| 国产成人免费网站| 黄页视频在线91| 日韩高清电影一区| 亚洲成a人片在线不卡一二三区| 中文字幕在线播放不卡一区| 久久久久久久性| 欧美一区二区三级| 欧美三级韩国三级日本一级| 99久久99久久综合| 成人动漫中文字幕| 国产91综合一区在线观看| 激情小说亚洲一区| 久久精品国产久精国产| 日本色综合中文字幕| 亚洲小说春色综合另类电影| 亚洲精品中文在线| 亚洲欧洲无码一区二区三区| 国产精品毛片久久久久久| 久久久一区二区| 欧美mv和日韩mv的网站| 精品美女一区二区| 精品国产91洋老外米糕| 欧美sm极限捆绑bd| 久久久亚洲国产美女国产盗摄| 欧美成人女星排行榜| 精品国产免费人成在线观看| 欧美成人官网二区| 精品999在线播放| 国产亚洲人成网站| 国产亚洲午夜高清国产拍精品| 精品国产乱码久久久久久1区2区| 精品盗摄一区二区三区| 久久综合视频网| 国产欧美一区二区精品久导航| 久久久久久久久99精品| 欧美国产亚洲另类动漫| 中文字幕一区三区| 亚洲人成在线播放网站岛国| 一区二区成人在线| 日本不卡免费在线视频| 六月丁香综合在线视频| 国产一区欧美日韩| 成人免费av资源| 色哟哟一区二区在线观看| 欧美性大战xxxxx久久久| 欧美日韩一区二区在线观看视频| 6080yy午夜一二三区久久| 日韩久久久久久| 中文字幕+乱码+中文字幕一区| 一区二区中文字幕在线| 亚洲成a人v欧美综合天堂| 美洲天堂一区二卡三卡四卡视频 | 亚洲国产日韩a在线播放| 日本中文字幕一区| 国产精品一区在线观看你懂的| 99re这里只有精品6| 欧美日韩一级片网站| 精品乱人伦一区二区三区| 中文字幕制服丝袜成人av| 亚洲小少妇裸体bbw| 久久se这里有精品| 91麻豆成人久久精品二区三区| 欧美日韩1234| 亚洲国产精品精华液2区45| 亚洲一级电影视频| 国产在线视频不卡二| 色综合网站在线| 欧美一二三四区在线| 国产精品欧美精品| 免费看日韩a级影片| 国产成人精品在线看| 欧美日韩国产免费| 国产精品沙发午睡系列990531| 亚洲午夜久久久久| 成人av在线播放网址| 制服丝袜av成人在线看| 中文字幕色av一区二区三区| 奇米影视一区二区三区| 91在线视频观看| 久久综合九色综合97_久久久| 一区二区三区四区av| 国产福利一区二区三区视频 | 视频一区在线视频| 99视频超级精品| 精品免费99久久| 亚洲电影一级片| 99在线精品视频| 精品国产亚洲一区二区三区在线观看| 一区二区三区精品在线| 成人亚洲一区二区一| 91精品国产一区二区三区香蕉| 亚洲卡通动漫在线| 成人中文字幕在线| 精品粉嫩aⅴ一区二区三区四区 | 国产精品1024久久| 欧美一区二区视频在线观看| 一区二区三区四区亚洲| 成人精品免费网站| 国产日韩欧美一区二区三区综合| 美女视频第一区二区三区免费观看网站| 91在线免费播放| 欧美激情在线免费观看| 免费成人av资源网| 欧美喷潮久久久xxxxx| 亚洲最色的网站| 色综合夜色一区| 中文字幕一区二区三区乱码在线| 国产电影一区在线| 久久色在线观看| 国产一区二区三区在线观看免费 | 欧美肥胖老妇做爰| 亚洲国产精品一区二区久久恐怖片| 99国产精品国产精品久久| 国产精品免费免费| 成人激情开心网| 国产色产综合色产在线视频 | 激情综合色播激情啊| 91麻豆精品国产| 日韩中文欧美在线| 欧美日韩国产影片| 肉色丝袜一区二区| 欧美一卡二卡在线| 激情五月婷婷综合网| 精品国产乱码久久久久久久久 | 久久九九99视频| 国产在线国偷精品免费看| 日韩午夜在线播放| 久久 天天综合| 国产亚洲欧美日韩在线一区| 国产精品888| 国产精品免费av| 91亚洲精品一区二区乱码| 一区二区三区四区视频精品免费| 91国产视频在线观看| 天涯成人国产亚洲精品一区av| 欧美久久一二区| 精品在线播放免费| 国产目拍亚洲精品99久久精品| 成人在线综合网站| 亚洲自拍偷拍麻豆| 欧美二区在线观看| 国产一区二区不卡| 亚洲免费资源在线播放| 欧美日韩第一区日日骚| 久久黄色级2电影| 欧美韩日一区二区三区四区| 91蜜桃在线免费视频| 性做久久久久久| 日韩欧美久久一区| 波多野结衣一区二区三区| 亚洲九九爱视频| 日韩丝袜美女视频| fc2成人免费人成在线观看播放| 洋洋av久久久久久久一区| 精品噜噜噜噜久久久久久久久试看| 丁香天五香天堂综合| 亚洲福利国产精品| 国产亚洲精品资源在线26u| 91麻豆精品秘密| 六月丁香婷婷久久| 亚洲卡通欧美制服中文| 日韩欧美一区二区三区在线| 成人黄页毛片网站| 欧美aaa在线| 亚洲青青青在线视频| 日韩欧美国产麻豆| 日本高清不卡一区| 韩国女主播成人在线观看| 亚洲精品免费在线观看| 精品国精品国产| 欧美午夜精品一区二区三区| 国产一区二区看久久| 亚洲第一主播视频| 中文字幕乱码日本亚洲一区二区 | 欧美精品xxxxbbbb| 大白屁股一区二区视频| 日本亚洲三级在线| 亚洲欧美色图小说| 国产日韩欧美一区二区三区综合| 欧美精品一卡二卡| 色婷婷av一区二区三区大白胸 | 国产精品国产精品国产专区不蜜 | 欧美韩日一区二区三区| 欧美一区二区三区四区在线观看 |