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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? ch14.htm

?? 21天學(xué)會VC的英文版
?? 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>

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
午夜a成v人精品| 成人免费视频一区二区| 欧美三级日韩三级国产三级| 亚洲欧美综合网| 精品国产乱码久久久久久影片| 亚洲国产精品一区二区久久恐怖片 | 久久精品欧美一区二区三区麻豆| 美腿丝袜亚洲三区| 日韩一区二区中文字幕| 另类综合日韩欧美亚洲| 91精品国产手机| 日本女人一区二区三区| 91精品国产色综合久久不卡电影| 午夜久久久久久久久久一区二区| 欧美精品国产精品| 日韩av中文字幕一区二区| 9191精品国产综合久久久久久| 午夜精品久久久久久久99樱桃| 欧美精品在线观看播放| 五月天一区二区| 欧美一区二区三区视频在线| 久久不见久久见免费视频1| 久久午夜老司机| 国产suv精品一区二区883| 中文天堂在线一区| 色拍拍在线精品视频8848| 亚洲国产精品久久一线不卡| 在线播放国产精品二区一二区四区| 午夜电影网亚洲视频| 欧美一级一区二区| 精品无码三级在线观看视频| 国产亚洲一区字幕| av在线一区二区三区| 亚洲永久精品国产| 欧美一区二区三区成人| 精品一区二区国语对白| 中文字幕第一页久久| 色婷婷国产精品综合在线观看| 亚洲午夜精品久久久久久久久| 7777精品伊人久久久大香线蕉经典版下载 | 99热国产精品| 一区二区三区视频在线观看| 欧美老年两性高潮| 精品中文字幕一区二区| 欧美国产国产综合| 欧美亚洲尤物久久| 久久er99精品| 亚洲欧洲日韩女同| 欧美日韩精品免费| 国产一区二区不卡| 亚洲男人都懂的| 日韩一区二区不卡| 成人精品免费看| 午夜亚洲福利老司机| 久久综合久久综合久久综合| 91在线视频播放| 日韩电影在线一区| 中文字幕免费不卡在线| 欧美日韩成人一区二区| 国产成人av在线影院| 一级精品视频在线观看宜春院 | 91精品国产综合久久精品| 国产精品99精品久久免费| 亚洲人成影院在线观看| 欧美一区二区三区视频免费播放| 成人免费观看av| 无吗不卡中文字幕| 国产欧美日韩不卡免费| 欧美日韩大陆在线| 成人a免费在线看| 男人的j进女人的j一区| 亚洲日本乱码在线观看| 日韩欧美一区二区久久婷婷| 91视频.com| 精品一区二区免费看| 一区二区三区欧美视频| 欧美精品一区在线观看| 在线观看区一区二| 丁香六月久久综合狠狠色| 亚洲成人www| 中文字幕亚洲视频| 日韩你懂的在线观看| 色婷婷综合久久久久中文| 狠狠v欧美v日韩v亚洲ⅴ| 一区二区三区欧美激情| 国产精品丝袜久久久久久app| 日韩一区二区三区三四区视频在线观看| 成人av中文字幕| 激情综合网激情| 亚洲成av人片www| 亚洲欧美另类久久久精品2019| 精品成人一区二区三区| 欧美精品vⅰdeose4hd| 91麻豆6部合集magnet| 国产精品一区二区三区四区| 日本亚洲一区二区| 亚洲激情av在线| 国产精品久久久久三级| 26uuu亚洲| 在线不卡中文字幕播放| 91黄色免费观看| 不卡一区二区中文字幕| 国产风韵犹存在线视精品| 麻豆精品视频在线| 午夜精品福利一区二区三区av| 中文字幕日韩欧美一区二区三区| 久久久久久久久久久99999| 51久久夜色精品国产麻豆| 欧美午夜精品电影| 色综合天天视频在线观看| 成人综合激情网| 国产伦精品一区二区三区免费迷| 蜜臀av性久久久久蜜臀av麻豆| 三级影片在线观看欧美日韩一区二区| 亚洲精品视频免费看| 中文字幕一区二区三区四区不卡 | 国产色产综合色产在线视频| 欧美大片在线观看一区| 91精品国产色综合久久不卡电影| 欧美性色欧美a在线播放| 91原创在线视频| eeuss鲁片一区二区三区| av亚洲精华国产精华精| 成人午夜av在线| 国产99久久久国产精品免费看 | 日本中文在线一区| 日本最新不卡在线| 日韩国产精品久久久| 日韩和欧美一区二区| 午夜精品久久久久久不卡8050| 亚洲bt欧美bt精品777| 石原莉奈一区二区三区在线观看| 午夜免费久久看| 免费欧美高清视频| 日韩高清不卡在线| 免费观看在线色综合| 免费看黄色91| 久久精品国产久精国产| 极品少妇xxxx精品少妇偷拍 | 国产一区91精品张津瑜| 狠狠色丁香婷综合久久| 国产成人在线视频播放| 成人激情开心网| 91浏览器入口在线观看| 91高清在线观看| 欧美日韩专区在线| 91.xcao| 欧美xxxxx牲另类人与| 国产亚洲一区二区三区在线观看 | 午夜精品福利视频网站| 日日摸夜夜添夜夜添精品视频 | 欧美日韩中文另类| 欧美老女人第四色| 精品国产区一区| 国产精品视频一二| 亚洲精品高清在线观看| 午夜欧美一区二区三区在线播放| 蜜桃在线一区二区三区| 国产一区二区剧情av在线| 成人免费高清视频| 色偷偷88欧美精品久久久| 7777精品伊人久久久大香线蕉最新版| 日韩精品一区二区三区视频在线观看 | 国产精品久久久99| 亚洲欧美电影院| 日韩中文字幕区一区有砖一区| 美洲天堂一区二卡三卡四卡视频| 国产成人精品亚洲777人妖| 99久久99久久久精品齐齐| 欧美三级在线视频| 欧美成人video| 国产精品免费久久久久| 亚洲国产一区二区三区| 麻豆一区二区99久久久久| 豆国产96在线|亚洲| 日本韩国欧美在线| 日韩欧美激情一区| 欧美国产综合色视频| 亚洲国产综合视频在线观看| 国内欧美视频一区二区 | 国产精品一区不卡| 日本乱码高清不卡字幕| 日韩欧美国产一区二区三区| 国产精品免费观看视频| 日韩av在线发布| 97aⅴ精品视频一二三区| 91精品国产色综合久久不卡电影 | 黑人巨大精品欧美黑白配亚洲| 91小视频在线| 日韩午夜在线观看视频| 国产精品国产三级国产普通话三级| 丝袜美腿高跟呻吟高潮一区| 国产91精品一区二区麻豆网站 | 日韩黄色在线观看| a4yy欧美一区二区三区| 91精品国产一区二区三区香蕉| 国产精品九色蝌蚪自拍| 免费日本视频一区| 色综合久久久久久久久| 精品国精品自拍自在线|