亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
欧美在线|欧美| 日本视频免费一区| 亚洲一区二区精品3399| 日韩av一级片| 97久久精品人人爽人人爽蜜臀| 欧美人xxxx| 自拍偷在线精品自拍偷无码专区| 日本午夜精品一区二区三区电影| 成人免费视频播放| 精品日韩欧美在线| 午夜精品久久久久久久久| 成人精品国产福利| 精品久久久久久久久久久院品网 | 亚洲欧美在线aaa| 九九久久精品视频| 5月丁香婷婷综合| 夜夜精品视频一区二区| 高清久久久久久| 国产天堂亚洲国产碰碰| 韩国成人福利片在线播放| 777精品伊人久久久久大香线蕉| 亚洲手机成人高清视频| 国产91丝袜在线18| 中文字幕的久久| 狠狠色丁香九九婷婷综合五月| 欧美日本一区二区| 亚洲成人一区二区| 欧美日韩高清一区二区| 亚洲一区二区三区中文字幕| 91小视频免费观看| 国产精品久久久久久一区二区三区| 久久99热这里只有精品| 一区二区三区日韩欧美精品| 91日韩精品一区| 一区二区三区在线视频播放| 色综合天天综合| 亚洲已满18点击进入久久| 日本久久电影网| 一区二区三区视频在线观看| 在线精品视频一区二区三四| 亚洲一二三区视频在线观看| 欧美嫩在线观看| 日本特黄久久久高潮| 欧美成人aa大片| 国产91高潮流白浆在线麻豆 | 国产激情偷乱视频一区二区三区| 26uuu国产日韩综合| 国产精品亚洲成人| 中文字幕欧美一| 欧美在线|欧美| 麻豆久久久久久| 欧美tk—视频vk| 成人精品在线视频观看| 一区二区三区在线观看动漫| 欧美日韩三级一区二区| 久久99精品久久久久久国产越南 | 欧美成人综合网站| 成人午夜免费电影| 亚洲黄色录像片| 9191久久久久久久久久久| 国模娜娜一区二区三区| 一色桃子久久精品亚洲| 欧美日韩黄色一区二区| 国产一二精品视频| 一区二区三区四区av| 日韩小视频在线观看专区| 国产不卡视频一区| 亚洲免费观看在线视频| 精品国产成人系列| 色婷婷av一区二区三区大白胸| 亚洲成人一二三| 国产偷国产偷亚洲高清人白洁| 欧美午夜电影在线播放| 国产综合久久久久久久久久久久| 亚洲欧洲日韩在线| 日韩免费视频线观看| 色综合天天在线| 国产精品一区二区在线观看网站| 亚洲一二三四在线| 国产精品视频一二三| 欧美日本韩国一区| 成人高清免费观看| 美女www一区二区| 亚洲最快最全在线视频| 国产亚洲人成网站| 欧美一级日韩免费不卡| 色婷婷精品久久二区二区蜜臀av | 欧美视频三区在线播放| 成人h精品动漫一区二区三区| 免费成人在线观看| 一区二区三区蜜桃| 亚洲国产精品成人综合色在线婷婷| 欧美精品99久久久**| 欧美系列亚洲系列| 91色婷婷久久久久合中文| 国产麻豆视频精品| 奇米影视在线99精品| 亚洲高清视频在线| 亚洲黄色av一区| 亚洲精选视频在线| 专区另类欧美日韩| 国产精品三级av| 久久精品视频网| 精品99999| 精品国产伦一区二区三区观看方式 | 国产成人av电影在线观看| 日韩—二三区免费观看av| 午夜一区二区三区视频| 亚洲女同ⅹxx女同tv| 国产精品不卡一区二区三区| 性做久久久久久| 色国产精品一区在线观看| 成人成人成人在线视频| 国产成人啪免费观看软件| 国产综合久久久久久鬼色| 九九**精品视频免费播放| 久久99深爱久久99精品| 国产麻豆视频一区| 国产精品小仙女| 成人免费不卡视频| 99re这里都是精品| 日本韩国精品一区二区在线观看| a亚洲天堂av| 91精彩视频在线| 欧美精品色一区二区三区| 欧美一区二区三区免费| 欧美刺激脚交jootjob| 精品女同一区二区| 国产欧美一区二区精品忘忧草| 国产精品女主播在线观看| 亚洲日本一区二区三区| 亚洲与欧洲av电影| 琪琪久久久久日韩精品| 国产精品一区二区黑丝| 成人禁用看黄a在线| 91麻豆精东视频| 91麻豆精品国产| 精品国产自在久精品国产| 国产人久久人人人人爽| 亚洲男女一区二区三区| 天堂资源在线中文精品| 久久se这里有精品| jlzzjlzz亚洲女人18| 欧美亚洲禁片免费| 精品成人a区在线观看| 国产精品国模大尺度视频| 亚洲成a天堂v人片| 国产毛片精品国产一区二区三区| 色悠悠久久综合| 欧美一区二区福利视频| 亚洲国产精品ⅴa在线观看| 亚洲成人精品一区二区| 韩国精品主播一区二区在线观看| 一本色道亚洲精品aⅴ| 欧美大片在线观看| 亚洲日本韩国一区| 久草精品在线观看| 91片在线免费观看| 久久综合久色欧美综合狠狠| 亚洲精品国产一区二区精华液| 蜜臀精品一区二区三区在线观看 | 中文字幕欧美激情| 日韩经典中文字幕一区| 波多野结衣91| 欧美mv和日韩mv的网站| 亚洲精品乱码久久久久| 国产成人激情av| 日韩精品一区国产麻豆| 亚洲综合免费观看高清在线观看| 久久99精品国产.久久久久久| 色婷婷综合久久久中文字幕| 久久亚洲综合av| 免费久久精品视频| 欧美日韩国产三级| 国产精品国产三级国产aⅴ原创| 蜜桃视频免费观看一区| 色播五月激情综合网| 国产调教视频一区| 精品一区免费av| 欧美一区二区在线看| 亚洲成人动漫一区| 91小视频在线观看| 中文字幕在线不卡国产视频| 黄色小说综合网站| 欧美一卡二卡三卡| 亚洲国产日韩在线一区模特| 99久久精品免费看| 国产精品久久久久永久免费观看| 国产一区二区三区在线观看免费视频 | 欧美在线不卡视频| 亚洲女人****多毛耸耸8| 风间由美性色一区二区三区| 久久色视频免费观看| 久久99精品国产.久久久久| 欧美一区二区三区的| 日本不卡的三区四区五区| 欧美日韩国产综合一区二区| 亚洲成人综合视频| 4438x亚洲最大成人网| 丝袜亚洲另类欧美|