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

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

?? ch14.htm

?? /// //Visual C++ 6.0 21天自學教程
?? HTM
?? 第 1 頁 / 共 5 頁
字號:
<PRE>1:  void CDbOdbcView::OnRecordNew() 2:  {3:      // TODO: Add your command handler code here4:      // Get a pointer to the record set5:      CRecordset* pSet = OnGetRecordset();6:      // Make sure that any changes to the current record7:      // have been saved8:      if (pSet-&gt;CanUpdate() &amp;&amp; !pSet-&gt;IsDeleted())9:      {10:         pSet-&gt;Edit();11:         if (!UpdateData())12:             return;13:14:         pSet-&gt;Update();15:     }16:     // Get the ID for the new record17:     long m_lNewID = m_pSet-&gt;GetMaxID() + 1;18:     // Add the new record19:     m_pSet-&gt;AddNew();20:     // Set the ID in the new record21:     m_pSet-&gt;m_AddressID = m_lNewID;22:     // Save the new record23:     m_pSet-&gt;Update();24:     // Refresh the record set25:     m_pSet-&gt;Requery();26:     // Move to the new record27:     m_pSet-&gt;MoveLast();28:     // Update the form29:     UpdateData(FALSE);30: }</PRE><P>Add a new toolbar button for the New Record menu, and then compile and run yourapplication. You should be able to add new records to the database, entering thedata you want into the records.</P><P><H3><A NAME="Heading9"></A>Deleting Records</H3><P>The only functionality remaining is the ability to delete the current record fromthe database. You'll need to add another menu entry to trigger this action. Oncethe action is triggered, you'll verify that the user really does want to delete thecurrent record and then call the Delete function to remove the record. Once the recordhas been deleted, you'll call the MovePrev function to navigate to the previous recordin the set.</P><P>To add this functionality to your application, you'll need a menu entry that theuser can select to delete the current record from the database. Add a new menu entryto the Record menu. Configure the new menu entry with the properties in Table 14.9.</P><P><H4>TABLE 14.9. MENU PROPERTY SETTINGS.</H4><P><TABLE BORDER="1">	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT"><I>Object</I></TD>		<TD ALIGN="LEFT"><I>Property</I></TD>		<TD ALIGN="LEFT"><I>Setting</I></TD>	</TR>	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT">			<PRE>Menu Entry</PRE>		</TD>		<TD ALIGN="LEFT">			<PRE>ID</PRE>		</TD>		<TD ALIGN="LEFT">			<PRE>IDM_RECORD_DELETE</PRE>		</TD>	</TR>	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT">			<P>		</TD>		<TD ALIGN="LEFT">Caption		</TD>		<TD ALIGN="LEFT">&amp;Delete Record		</TD>	</TR>	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT">			<P>		</TD>		<TD ALIGN="LEFT">Prompt		</TD>		<TD ALIGN="LEFT">Delete the current record\nDelete Record		</TD>	</TR></TABLE></P><P>Using the Class Wizard, add an event-handler function for the COMMAND event messagefor this menu to the view class, CDbOdbcView. Edit this function, adding the codein Listing 14.6.</P><P><H4>LISTING 14.6. THE CDbOdbcView OnRecordDelete FUNCTION.</H4><PRE>1:  void CTestdb5View::OnRecordDelete() 2:  {3:      // TODO: Add your command handler code here4:      // Make sure the user wants to delete this record5:      if (MessageBox(&quot;Are you sure you want to delete this record?&quot;,6:              &quot;Delete this record?&quot;, MB_YESNO | MB_ICONQUESTION) ==                   &Acirc;IDYES)7:      {8:          // Delete the record9:          m_pSet-&gt;Delete();10:         // Move to the previous record11:         m_pSet-&gt;MovePrev();12:         // Update the form13:         UpdateData(FALSE);14:     }15: }</PRE><P>Add another button to the toolbar and associate it with the IDM_RECORD_DELETEmenu ID so that the user can delete the current record without having to go to themenu. If you compile and run your application at this point, you'll have a full-functiondatabase application in which you can add, edit, and delete records, as shown inFigure 14.10.</P><P><A HREF="javascript:popUp('14fig11.gif')"><B>FIGURE 14.10.</B></A><B> </B><I>Thecompleted application.</I></P><P><I></I><H2><A NAME="Heading10"></A>Summary</H2><P>Today, you learned how you can use the ODBC interface to build database applicationsthat can be easily run against any database you might need to use. You saw how theCRecordset class provides you with a substantial amount of functionality so thatyou can provide database functionality in your applications. You also saw how theAppWizard provides you with a large amount of database functionality without yourtyping a single line of code.</P><P>Tomorrow, you will learn about Microsoft's newest database access technology,ActiveX Data Objects, and how this can be combined with the ODBC interface to makeyour database access even easier.</P><P><H2><A NAME="Heading11"></A>Q&amp;A</H2><DL>	<DT></DT>	<DD><B>Q Why would I want to use the ODBC interface instead of the Data Access Objects?</B>	<P>	<DT><B></B></DT>	<DD><B>A</B> The Data Access Objects (DAO) use the Microsoft Jet database engine	to perform all of the database access. This adds at least a megabyte of overhead	to your application, and if you're using a SQL-based database, the database is already	doing all of the work that the Jet engine is doing for you. What's more, the Jet	database engine uses the ODBC interface to access any SQL-based databases. As a result,	unless you are using PC-based databases, such as Access, FoxPro, or Paradox, you	get better performance from going directly to the ODBC interface yourself.	<P>	<DT></DT>	<DD><B>Q How can I add different record sets in an MDI application?</B>	<P>	<DT><B></B></DT>	<DD><B>A</B> You can add additional CRecordset-derived classes through the New Class	Wizard in an MDI application project. You need to specify that the new class is an	MFC class and that its base class is the CRecordset class. The New Class Wizard will	have you specify the data source, just as the AppWizard had you do when creating	the shell for today's application. Once you create the record set class, you can	create a new view class the same way, specifying the base class as CRecordView. Once	you click the OK button, the New Class Wizard asks you to specify which of the record	set classes to use with the new record view class.	<P></DL><H2><A NAME="Heading12"></A>Workshop</H2><P>The Workshop provides quiz questions to help you solidify your understanding ofthe material covered and exercises to provide you with experience in using what you'velearned. The answers to the quiz questions and exercises are provided in AppendixB, &quot;Answers.&quot;</P><P><H3><A NAME="Heading13"></A>Quiz</H3><DL>	<DT></DT>	<DD><B>1. </B>What does ODBC stand for?	<P>	<DT></DT>	<DD><B>2. </B>What functions can you use to navigate the record set in a CRecordset	object?	<P>	<DT></DT>	<DD><B>3. </B>What view class should you use with an ODBC application?	<P>	<DT></DT>	<DD><B>4. </B>What sequence of functions do you need to call to add a new record	to a record set?	<P>	<DT></DT>	<DD><B>5. </B>What function do you need to call before the fields in the CRecordset	object can be updated with any changes?	<P></DL><H3><A NAME="Heading14"></A>Exercise</H3><P>Add a menu entry and dialog to let the user indicate the record number to moveto, and then move to that record.</P><P><H2><A NAME="Heading15"></A>In Review</H2><P>Now that you've finished the second week, you should be getting very comfortableworking with Visual C++. You should be beginning to understand how you can use theMFC class hierarchy to provide a substantial amount of existing functionality inyour applications. You should also be starting to understand how much supportinginfrastructure your applications start with when you use the Visual C++ wizards toconstruct as much of your application as you can.</P><P>This is a good time to take a little break and try some of the things that you'velearned on your own. Build an MDI application, using a custom document type thatyou've come up with yourself. See how you can save and restore the document, as wellas maintain it. Practicing on your own is key to cementing your understanding ofwhat you've learned in this book. This will help you identify any areas that youmight need to go back and read again, as well as those areas where you feel comfortableenough to not review.</P><P>By this time, you should have a good understanding of the Document/View architectureand how it can be used to maintain the separation of the data from the representationof the data that is displayed for the user. You've used this model for both SingleDocument Interface (SDI) and Multiple Document Interface (MDI) style applications,and you've used it for reading and writing files to the disk drive. This model isone of the main building blocks of MFC applications built with Visual C++. You shouldknow where to place any initialization information for a new set of data and whereto clean up when closing a set of data.</P><P>You should also have a good understanding of how the SDI and MDI application stylesare alike and how they differ from each other and from the dialog application style.You should have a good idea of when an application you are building should use oneof these styles and when it should use a different style. You should be able to createyour own SDI and MDI applications, as you need to, without any significant problems.If you've got any questions about either of these areas, you might want to take anotherlook at Days 10 and 11 to review how the Document/View architecture works in bothSDI and MDI style applications.</P><P>You should understand how, in SDI and MDI style applications, you can save andrestore complex data structures in files on the system hard drive. You should beable to create mixed-type objects that you create and maintain in the document objectin your applications, be able to use the Serialize function with the CArchive objectto write the objects to a file, and then be able to restore the objects at a latertime. If you are having any trouble understanding how this works or are running intoany problems trying to implement this functionality in your own applications, reviewDay 13.</P><P>Along with reading and writing files, you also have learned how you can designand build toolbars for use in your SDI and MDI applications. At this point, you shouldbe completely comfortable with designing and creating your own toolbars and usingthem in your applications. You should understand the importance of matching the toolbarbutton ID to the ID of the menu for which the toolbar will be used as a substitute.You should also have a basic understanding of creating and using your own customizedstatus bar elements in SDI and MDI applications. You should understand how you canuse the UPDATE_COMMAND_UI event message to evaluate and alter the status of menu,toolbar, and status bar elements, relieving you of all the work of setting each ofthese elements, and how to maintain their appearance and status yourself. If youaren't clear on how you can do any of these things, you might want to go back overDay 12 one more time.</P><P>You've seen how you can build a simple database application, pulling data froma database through the ODBC interface. You should have a basic understanding of howyou can build database applications using this approach, how to maintain the data,how to add new records, and how to delete records. You should know how all the databaseinteraction is directed through the record set class and how you can directly controlthe data through this object. If you're not sure of some of this, you might wantto look back at Day 14 for a quick refresher.</P><P>You learned how easy it is to add ActiveX controls to your projects and how VisualC++ builds C++ classes around the control, enabling you to interact with the controlas if it were just another C++ object. You should have a good grasp of how to addany ActiveX control (armed with the documentation for the control) to your applicationand interact with it in a seamless manner. You should be able to declare a variablefor the control, set the control's properties, call its methods, and react to itsevents just as if it were a standard part of the Visual C++ development environment.If you aren't sure how you can do some of this, you might want to go back and rereadDay 9.</P><P>Finally, you started this week by learning how to draw graphics on the windowsof your applications. You learned how to draw lines, circles, and squares, usinga variety of pens and brushes. You even learned how you can make a customized brushfrom a bitmap. You learned how you can load a bitmap image from a file and displayit for the user to see. But most importantly, you learned about the device contextand how it is used to draw all these features on the windows of your applications.You should be able to use these and other figure drawing device context methods todraw any image you might want to draw on the window for the user to see and interactwith. If you are unsure about how you can do this, you probably want to look backat Day 8 once more.</P><P>By this time, you have built up quite a set of programming skills with VisualC++. You are probably ready to tackle most of the smaller programming tasks you mightencounter--and maybe even a few not-so-small tasks. At this point, you are well onyour way to becoming an accomplished Visual C++ programmer. That said--now is notthe time to stop because there's still more to be learned. There's only one moreweek to go, so tallyho!</P><P><H1></H1><CENTER><P><HR><A HREF="../ch13/ch13.htm"><IMG SRC="../button/previous.gif" WIDTH="128" HEIGHT="28"ALIGN="BOTTOM" ALT="Previous chapter" BORDER="0"></A><A HREF="../ch15/ch15.htm"><IMGSRC="../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> <BR><BR></P><P>&copy; <A HREF="../copy.htm">Copyright</A>, Macmillan Computer Publishing. Allrights reserved.</CENTER></BODY></HTML>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲国产综合视频在线观看| 免费观看一级欧美片| 欧美一区二区久久| 99re这里只有精品首页| 美女一区二区久久| 亚洲美女免费视频| 欧美精品一区二区三区蜜桃| 一本大道久久a久久精二百| 国产综合久久久久久鬼色| 亚洲欧美另类在线| 久久免费美女视频| 日韩手机在线导航| 在线观看亚洲一区| 成人午夜短视频| 国产精品资源网| 蜜臀av性久久久久蜜臀aⅴ四虎| 国产一区二区不卡在线 | 一区二区三区视频在线看| 欧美四级电影在线观看| 国产不卡免费视频| 丝瓜av网站精品一区二区| 综合久久久久久久| 国产欧美精品一区| 久久在线观看免费| 91精品国产91久久久久久一区二区 | 欧美日韩一区二区三区视频| 欧美精选一区二区| 99久久精品国产精品久久| 国产在线播放一区三区四| 亚洲6080在线| 亚洲第一福利一区| 一区二区理论电影在线观看| 国产精品久久久久久久久晋中| 97超碰欧美中文字幕| 国产aⅴ精品一区二区三区色成熟| 欧美国产一区视频在线观看| 日韩午夜激情视频| 日韩美女视频一区二区在线观看| 国产99一区视频免费| 久久se精品一区二区| 美女在线观看视频一区二区| 免费不卡在线视频| 午夜免费久久看| 午夜精品久久久久久久久| 五月天亚洲精品| 青青草伊人久久| 久久成人久久鬼色| 激情另类小说区图片区视频区| 日韩美女视频一区二区| 综合色天天鬼久久鬼色| 亚洲精品欧美综合四区| 亚洲欧美日韩国产手机在线| 亚洲免费成人av| 亚洲午夜免费福利视频| 午夜精品久久久久久久久久久| 国产三级三级三级精品8ⅰ区| 色呦呦国产精品| 色婷婷综合激情| 欧美日韩一级视频| 欧美一二区视频| 久久久亚洲高清| 欧美经典一区二区三区| 亚洲欧洲精品一区二区三区 | 丰满亚洲少妇av| 99久久er热在这里只有精品15| 捆绑调教美女网站视频一区| 国产一二三精品| 99久久99久久免费精品蜜臀| 欧美色图天堂网| 日韩久久免费av| 国产精品久久久久久福利一牛影视 | 久久精品亚洲乱码伦伦中文| 国产日产精品1区| 亚洲尤物视频在线| 久久草av在线| 91在线云播放| 日韩精品中文字幕一区二区三区| 91久久香蕉国产日韩欧美9色| 国产精品亚洲а∨天堂免在线| 日韩影院在线观看| 国产在线视频一区二区三区| 粉嫩久久99精品久久久久久夜| 极品瑜伽女神91| 色视频欧美一区二区三区| 欧美日本国产视频| 国产嫩草影院久久久久| 一区二区三区日韩欧美| 蜜桃免费网站一区二区三区| 成人黄色综合网站| 欧美顶级少妇做爰| 中文字幕一区二区在线观看| 日韩不卡一区二区三区| a在线欧美一区| 91麻豆精品国产91久久久| 国产校园另类小说区| 日精品一区二区| 91网站黄www| 精品国产青草久久久久福利| 亚洲综合激情网| 国产乱人伦精品一区二区在线观看 | 国产电影一区二区三区| 91福利精品视频| 国产亚洲欧美日韩在线一区| 亚洲女同一区二区| 国产乱人伦精品一区二区在线观看| 国产在线一区观看| 欧美日韩一区二区三区免费看| 欧美三级韩国三级日本一级| 久久综合国产精品| 日韩专区在线视频| 91国产免费观看| 国产精品看片你懂得| 激情国产一区二区| 日韩视频中午一区| 亚洲18女电影在线观看| 91久久一区二区| 中文字幕一区二区三区四区 | 欧美私人免费视频| 欧美精彩视频一区二区三区| 久久国产精品第一页| 欧美丝袜丝交足nylons| 亚洲精品视频一区二区| 不卡高清视频专区| 欧美韩日一区二区三区| 国产综合色在线| 久久网站最新地址| 久久国产尿小便嘘嘘尿| 日韩一区二区三区四区五区六区| 久久久久久亚洲综合| 国内精品视频一区二区三区八戒| 国产成人在线网站| 久久久久久久久久久黄色| 韩国一区二区三区| 久久亚洲一级片| 国产一区中文字幕| 久久五月婷婷丁香社区| 国产一区二区三区在线观看免费视频| 国产精品99久久久| 日韩免费视频一区二区| 久久成人久久爱| 精品精品国产高清a毛片牛牛| 1区2区3区欧美| 一本久久综合亚洲鲁鲁五月天 | 激情综合五月天| 精品免费99久久| 国产精品一区二区x88av| 国产欧美一区二区精品久导航| 亚洲男人的天堂网| 欧美亚洲愉拍一区二区| 亚洲成人在线网站| 欧美一级电影网站| 久久精品国产第一区二区三区| 成人久久18免费网站麻豆 | 日本成人在线视频网站| 欧美一区二区大片| 极品少妇xxxx精品少妇偷拍| 国产香蕉久久精品综合网| 国产美女娇喘av呻吟久久| 中文字幕二三区不卡| 色偷偷成人一区二区三区91| 亚洲高清免费在线| 欧美一区中文字幕| 狠狠色丁香婷综合久久| 国产精品久久夜| 91福利小视频| 极品少妇xxxx精品少妇| 国产精品久久久久久妇女6080| 久久99国产精品尤物| 国产精品福利在线播放| 在线观看视频一区二区欧美日韩| 国产欧美精品在线观看| 欧洲视频一区二区| 久久精品国产在热久久| 国产精品污污网站在线观看| 欧美亚男人的天堂| 九九视频精品免费| 亚洲欧洲www| 91精品在线麻豆| 国产一区欧美一区| 亚洲人成网站精品片在线观看| 丁香一区二区三区| 亚洲精品视频在线看| 精品国产自在久精品国产| 99vv1com这只有精品| 久久精品99国产精品| 综合久久久久久久| 欧美va亚洲va香蕉在线| 91色乱码一区二区三区| 美女任你摸久久| 亚洲黄色性网站| 久久久久99精品国产片| 欧美日韩国产精品成人| 国产69精品久久777的优势| 日本va欧美va精品| 亚洲欧美另类久久久精品2019| 色八戒一区二区三区| 国产在线精品国自产拍免费| 亚洲一级在线观看| 亚洲欧美综合另类在线卡通| 欧美一级在线观看|