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

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

?? ch14.htm

?? Learn SQL in an easy way...
?? HTM
?? 第 1 頁 / 共 2 頁
字號:
a problem is in the database or in the program. The second use is to generate andcheck queries. Add the following line to the SQL box and click OK:</P><PRE><FONT COLOR="#0066FF">WHERE CUSTOMER.NAME = ORDERS.NAME AND PART.PARTNUM = ORDERS.PARTNUM</FONT></PRE><P>Figure 14.15 shows the remarkable result.</P><P><A NAME="15"></A><A HREF="15.htm"><B>Figure 14.15.</B></A></P><P><I>Query's graphic representation of a join.</I></P><P>You have just performed a join! Not only that, but the fields you joined on havebeen graphically connected in the table diagrams (note the zigzag lines between <TT>NAME</TT>and <TT>PARTNUM</TT>).</P><P>Query is an important tool to have in your SQL arsenal on the Windows softwareplatform. It enables you examine and manipulate tables and queries. You can alsouse it to create tables and manipulate data. If you work in Windows with ODBC andSQL, either buy this tool yourself or have your company or client buy it for you.It is not as interesting as a network version of DOOM, but it will save you timeand money. Now that you have established an ODBC link, you can use it in a program.<H2><FONT COLOR="#000077">Using Visual C++ and SQL</FONT></H2><BLOCKQUOTE>	<P><HR><FONT COLOR="#000077"><B>NOTE:</B></FONT><B> </B>The source code for this example	is located in Appendix B, &quot;Source Code Listings for the C++ Program Used on	Day 14.&quot; <HR></BLOCKQUOTE><P>Call up Visual C++ and select AppWizard, as shown in Figure 14.16. The name andsubdirectory for your project do not have to be identical.</P><P><A NAME="16"></A><A HREF="16.htm"><B>Figure 14.16.</B></A></P><P><I>Initial project setup.</I></P><P>Click the Options button and fill out the screen as shown in Figure 14.17.</P><P><A NAME="17"></A><A HREF="17.htm"><B>Figure 14.17.</B></A></P><P><I>The Options dialog box.</I></P><P>Click OK and then choose Database Options. Select Database Support, No File Supportas shown in Figure 14.18.</P><P><A NAME="18"></A><A HREF="18.htm"><B>Figure 14.18.</B></A></P><P><I>The Database Options dialog box.</I></P><P>Click the Data Source button and make the choices shown in Figure 14.19.</P><P><A NAME="19"></A><A HREF="19.htm"><B>Figure 14.19.</B></A></P><P><I>Selecting a data source.</I></P><P>Then select the <TT>CUSTOMER</TT> table from the Select a Table dialog box, shownin Figure 14.20.</P><P><A NAME="20"></A><A HREF="20.htm"><B>Figure 14.20.</B></A></P><P><I>Selecting a table.</I></P><P>Now you have selected the <TT>CUSTOMER</TT> table from the TYSSQL database. Goback to the AppWizard basic screen by clicking OK twice. Then click OK again to displaythe new application information (see Figure 14.21), showing the specifications ofa new skeleton application.</P><P><A NAME="21"></A><A HREF="21.htm"><B>Figure 14.21.</B></A></P><P><I>AppWizard's new application information.</I></P><P>After the program is generated, you need to use the resource editor to designyour main screen. Select Tools | App Studio to launch App Studio. The form you designwill be simple--just enough to show some of the columns in your table as you scrollthrough the rows. Your finished form should look something like Figure 14.22.</P><P><A NAME="22"></A><A HREF="22.htm"><B>Figure 14.22.</B></A></P><P><I>Finished form in App Studio.</I></P><P>For simplicity we named the edit boxes <TT>IDC_NAME</TT>,<TT> IDC_ADDRESS</TT>,<TT>IDC_STATE</TT>, and<TT> IDC_ZIP</TT>, although you can name them whatever youchoose. Press Ctrl+W to send the Class Wizard page to the Member Variables and setthe variables according to Figure 14.23.</P><P><A NAME="23"></A><A HREF="23.htm"><B>Figure 14.23.</B></A></P><P><I>Adding member variables in Class Wizard.</I></P><BLOCKQUOTE>	<P><HR><FONT COLOR="#000077"><B>NOTE:</B></FONT><B> </B>The program was nice enough to provide	links to the table to which you are connected. Links are one of the benefits of working	through Microsoft's wizards or Borland's experts. <HR></BLOCKQUOTE><P>Save your work; then press Alt+Tab to return to the compiler and compile the program.If all went well, your output should look like Figure 14.24. If it doesn't, retraceyour steps and try again.</P><P><A NAME="24"></A><A HREF="24.htm"><B>Figure 14.24.</B></A></P><P><I>A clean compile for the test program.</I></P><P>Now run your program. It should appear, after that pesky logon screen, and looklike Figure 14.25.</P><P><A NAME="25"></A><A HREF="25.htm"><B>Figure 14.25.</B></A></P><P><I>The test program.</I></P><P>An impressive program, considering that you have written zero lines of code sofar. Use the arrow keys on the toolbar to move back and forth in the database. Noticethat the order of the data is the same as its input order. It is not alphabetical(unless you typed it in that way). How can you change the order?</P><P>Your connection to the database is encapsulated in a class called <TT>Ctyssqlset</TT>,which the AppWizard created for you. Look at the header file (<TT>tyssqset.h</TT>):</P><PRE><FONT COLOR="#0066FF">// tyssqset.h : interface of the CTyssqlSet class//////////////////////////////////////////////////////////////////////////class CTyssqlSet : public CRecordset{DECLARE_DYNAMIC(CTyssqlSet)public:CTyssqlSet(CDatabase* pDatabase = NULL);// Field/Param Data//{{AFX_FIELD(CTyssqlSet, CRecordset)Cstring    m_NAME;Cstring    m_ADDRESS;Cstring    m_STATE;Cstring    m_ZIP;Cstring    m_PHONE;Cstring    m_REMARKS;//}}AFX_FIELD// Implementationprotected:virtual CString GetDefaultConnect();// Default connection stringvirtual CString GetDefaultSQL();// default SQL for Recordsetvirtual void DoFieldExchange(CFieldExchange* pFX);// RFX support};</FONT></PRE><H5>ANALYSIS:</H5><P>Note that member variables have been constructed for all the columns in the table.Also notice the functions <TT>GetDefaultConnect</TT> and <TT>GetDefaultSQL</TT>;here's their implementations from <TT>tyssqset.cpp</TT>:</P><PRE><FONT COLOR="#0066FF">CString CTyssqlSet::GetDefaultConnect(){return ODBC;DSN=TYSSQL;&quot;;}CString CTyssqlSet::GetDefaultSQL(){return &quot;CUSTOMER&quot;;}</FONT></PRE><P><TT>GetDefaultConnect</TT> makes the ODBC connection. You shouldn't change it.However, <TT>GetDefaultSQL</TT> enables you to do some interesting things. Changeit to this:</P><PRE><FONT COLOR="#0066FF">return &quot;SELECT * FROM CUSTOMER ORDER BY NAME&quot;;</FONT></PRE><P>Recompile, and magically your table is sorted by name, as shown in Figure 14.26.</P><P><A NAME="26"></A><A HREF="26.htm"><B>Figure 14.26.</B></A></P><P><I>Database order changed by SQL.</I></P><P>Without going into a tutorial on the Microsoft Foundation Class, let us just saythat you can manipulate <TT>CRecordSet</TT> and <TT>Cdatabase</TT> objects, joinand drop tables, update and insert rows, and generally have all the fun possiblein SQL. You have looked as far over the edge as you can, and we have pointed theway to integrate SQL into C++ applications. Topics suggested for further study are<TT>CRecordSet</TT> and <TT>Cdatabase</TT> (both in the C++ books online that shouldcome as part of the C++ software), ODBC API (the subject of several books), and theAPIs provided by Oracle and Sybase (which are both similar to the ODBC API).<H2><FONT COLOR="#000077">Using Delphi and SQL</FONT></H2><P>Another important database tool on the Windows software platform is Delphi. Thesplash that comes up as the program is loading has a picture of the Oracle at Delphi,surrounded by the letters SQL. In the C++ example you rewrote one line of code. UsingDelphi, you will join two tables without writing a single line of code!<BLOCKQUOTE>	<P><HR><FONT COLOR="#000077"><B>NOTE:</B></FONT><B> </B>The code for this program is located	in Appendix C, &quot;Source Code Listings for the Delphi Program Used on Day 14.&quot;	<HR></BLOCKQUOTE><P>Double-click Delphi's icon to get it started. At rest the program looks like Figure14.27.</P><P><A NAME="27"></A><A HREF="27.htm"><B>Figure 14.27.</B></A></P><P><I>The Delphi programming environment.</I></P><P>Delphi requires you to register any ODBC connections you are going to use in yourprogramming. Select BDE (Borland Database Environment) from the Tools menu and thenfill out the dialog box shown in Figure 14.28.</P><P><A NAME="28"></A><A HREF="28.htm"><B>Figure 14.28.</B></A></P><P><I>Registering your connections.</I></P><P>Click the Aliases tab shown at the bottom of Figure 14.28 and assign the nameTYSSQL, as shown in Figure 14.29.</P><P><A NAME="29"></A><A HREF="29.htm"><B>Figure 14.29.</B></A></P><P><I>Adding a new alias.</I></P><P>Select File | New Form to make the following selections. Start by choosing theDatabase Form from the Experts tab, as shown in Figure 14.30.</P><P><A NAME="30"></A><A HREF="30.htm"><B>Figure 14.30.</B></A></P><P><I>The Experts page in the Browse gallery.</I></P><P>Then choose the master/detail form and <TT>TQuery</TT> objects, as shown in Figure14.31.</P><P><A NAME="31"></A><A HREF="31.htm"><B>Figure 14.31.</B></A></P><P><I>The Database Form Expert dialog box.</I></P><BLOCKQUOTE>	<P><HR><FONT COLOR="#000077"><B>NOTE:</B></FONT><B> </B>Delphi enables you to work with	either a query or a table. If you need flexibility, we recommend the <TT>TQuery</TT>	object. If you need the whole table without modification, use the <TT>TTable</TT>	object. <HR></BLOCKQUOTE><P>Now select the TYSSQL data source you set up earlier, as shown in Figure 14.32.</P><P><A NAME="32"></A><A HREF="32.htm"><B>Figure 14.32.</B></A></P><P><I>Choosing a data source.</I></P><P>Choose the <TT>PART</TT> table as the master, as shown in Figure 14.33.</P><P><A NAME="33"></A><A HREF="33.htm"><B>Figure 14.33.</B></A></P><P><I>Choosing a table.</I></P><P>Choose all its fields, as shown in Figure 14.34.</P><P><A NAME="34"></A><A HREF="34.htm"><B>Figure 14.34.</B></A></P><P><I>Adding all the fields.</I></P><P>Pick the Horizontal display mode, as shown in Figure 14.35.</P><P><A NAME="35"></A><A HREF="35.htm"><B>Figure 14.35.</B></A></P><P><I>Display mode selection.</I></P><P>Then choose <TT>ORDERS</TT>, select all its fields, and select Grid for its displaymode, as shown in Figures 14.36, 14.37, and 14.38.</P><P><A NAME="36"></A><A HREF="36.htm"><B>Figure 14.36.</B></A></P><P><I>Choosing the table for the detail part of the form.</I></P><P><A NAME="37"></A><A HREF="37.htm"><B>Figure 14.37.</B></A></P><P><I>Selecting all the fields.</I></P><P><A NAME="38"></A><A HREF="38.htm"><B>Figure 14.38.</B></A></P><P><I>Selecting the orientation.</I></P><P>Now the software enables you to make a join. Make the join on <TT>PARTNUM</TT>,as shown in Figure 14.39.</P><P><A NAME="39"></A><A HREF="39.htm"><B>Figure 14.39.</B></A></P><P><I>Making the join.</I></P><P>Now go ahead and generate the form. The result looks like Figure 14.40.</P><P><A NAME="40"></A><A HREF="40.htm"><B>Figure 14.40.</B></A></P><P><I>The finished form.</I></P><P>Compile and run the program. As you select different parts, the order for themshould appear in the lower table, as shown in Figure 14.41.</P><P><A NAME="41"></A><A HREF="41.htm"><B>Figure 14.41.</B></A></P><P><I>The finished program.</I></P><P>Close the project and click one or both of the query objects on the form. Whenyou click an object, the Object Inspector to the left of the screen in Figure 14.42shows the various properties.</P><P><A NAME="42"></A><A HREF="42.htm"><B>Figure 14.42.</B></A></P><P><I>The query in the TQuery object.</I></P><P>Try experimenting with the query to see what happens. Just think what you cando when you start writing code!<H2><FONT COLOR="#000077">Summary</FONT></H2><P>Today you learned where to start applying SQL using the ordinary, everyday stuffyou find lying on your hard drive. The best way to build on what you have learnedis to go out and query. Query as much as you can.<H2><FONT COLOR="#000077">Q&amp;A</FONT></H2><P><B>Q What is the difference between the ODBC API and the Oracle and Sybase APIs?</B></P><P><B>A</B> On a function-by-function level, Oracle and Sybase are remarkably similar,which is not a coincidence. Multiple corporate teamings and divorces have led tolibraries that were derived from somewhat of a common base. ODBC's API is more generic--itisn't specific to any database. If you need to do something specific to a databaseor tune the performance of a specific database, you might consider using that database'sAPI library in your code.</P><P><B>Q With all the available products, how do I know what to use?</B></P><P><B>A</B> In a business environment, product selection is usually a compromisebetween management and &quot;techies.&quot; Management looks at the cost of a product;techies will look at the features and how the product can make their lives easier.In the best of all programming worlds, that compromise will get your job done quicklyand efficiently.<H2><FONT COLOR="#000077">Workshop</FONT></H2><P>The Workshop provides quiz questions to help solidify your understanding of thematerial covered, as well as exercises to provide you with experience in using whatyou have learned. Try to answer the quiz and exercise questions before checking theanswers in Appendix F, &quot;Answers to Quizzes and Exercises.&quot;<H3><FONT COLOR="#000077">Quiz</FONT></H3><DL>	<DD><B>1.</B> In which object does Microsoft Visual C++ place its SQL?	<P><B>2. </B>In which object does Delphi place its SQL?</P>	<P><B>3.</B> What is ODBC?</P>	<P><B>4.</B> What does Delphi do?</DL><H3><FONT COLOR="#000077">Exercises</FONT></H3><DL>	<DD><B>1.</B> Change the sort order in the C++ example from ascending to descending	on the <TT>State</TT> field.	<P><B>2.</B> Go out, find an application that needs SQL, and use it.</DL><H1></H1><CENTER><P><HR><A HREF="../ch13/ch13.htm"><IMG SRC="../buttonart/previous.gif" WIDTH="128" HEIGHT="28"ALIGN="BOTTOM" ALT="Previous chapter" BORDER="0"></A><A HREF="../wk2rev/wk2rev.htm"><IMGSRC="../buttonart/next.gif" WIDTH="128" HEIGHT="28" ALIGN="BOTTOM" ALT="Next chapter"BORDER="0"></A><A HREF="../index.htm"><IMG SRC="../buttonart/contents.gif" WIDTH="128"HEIGHT="28" ALIGN="BOTTOM" ALT="Contents" BORDER="0"></A> <BR><BR><BR><IMG SRC="../buttonart/corp.gif" WIDTH="284" HEIGHT="45" ALIGN="BOTTOM" ALT="Macmillan Computer Publishing USA"BORDER="0"></P><P>&#169; <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一区二区三区免费野_久草精品视频
国内外精品视频| 成人精品免费网站| 欧美激情一区二区三区蜜桃视频| 在线视频国内自拍亚洲视频| 国产精品白丝jk白祙喷水网站| 亚洲va天堂va国产va久| 亚洲国产精品ⅴa在线观看| 欧美一区二区三区免费观看视频| 91影院在线免费观看| 国产精品99久久久久久久vr| 天天综合天天做天天综合| 综合色天天鬼久久鬼色| 国产亚洲成av人在线观看导航| 欧美一级日韩不卡播放免费| 在线亚洲一区二区| av成人免费在线| 国产91对白在线观看九色| 免费高清视频精品| 偷偷要91色婷婷| 亚洲一区二区三区中文字幕在线| 国产精品麻豆久久久| 337p日本欧洲亚洲大胆精品| 日韩欧美不卡在线观看视频| 欧美伊人精品成人久久综合97 | 日韩一级大片在线观看| 欧美性色欧美a在线播放| 97se狠狠狠综合亚洲狠狠| 成人性生交大片免费看视频在线 | 色噜噜偷拍精品综合在线| av网站一区二区三区| 成人免费视频免费观看| 国产精品影视天天线| 国产一区二区三区免费播放| 久久99最新地址| 精品一区免费av| 国产伦精一区二区三区| 国产一区二区女| 国产成人精品亚洲777人妖 | 亚洲伊人伊色伊影伊综合网| 亚洲精品ww久久久久久p站| √…a在线天堂一区| 亚洲四区在线观看| 亚洲综合一区二区精品导航| 国产精品一区在线观看乱码| 国模少妇一区二区三区| 麻豆一区二区在线| 国产在线播放一区三区四| 国产夫妻精品视频| 不卡一区二区中文字幕| 色94色欧美sute亚洲13| 欧美日韩免费视频| 日韩欧美一区中文| 久久久精品影视| 亚洲欧洲国产专区| 亚洲不卡av一区二区三区| 青青青伊人色综合久久| 狠狠色丁香久久婷婷综| av电影一区二区| 欧美色综合影院| 日韩精品中文字幕在线不卡尤物| 久久综合九色综合欧美98| 国产精品久久久久国产精品日日| 国产精品美日韩| 亚洲国产精品欧美一二99| 男女男精品视频网| 成人精品视频.| 精品视频一区二区三区免费| 日韩视频一区二区三区| 国产蜜臀av在线一区二区三区| 亚洲欧美aⅴ...| 日本女优在线视频一区二区| 国产精品1区二区.| 欧美色综合久久| 久久日一线二线三线suv| 国产精品久久久久一区二区三区共 | 欧美日韩激情在线| 久久久精品免费网站| 尤物av一区二区| 精品亚洲国产成人av制服丝袜| 成人免费视频视频在线观看免费| 欧美三级蜜桃2在线观看| 26uuu精品一区二区在线观看| 亚洲日本一区二区| 看电影不卡的网站| 91香蕉国产在线观看软件| 日韩美女一区二区三区四区| 亚洲视频小说图片| 久久精品国产亚洲a| 91在线观看一区二区| 精品99久久久久久| 午夜不卡av免费| 成人美女视频在线观看18| 91精品国产综合久久蜜臀 | 《视频一区视频二区| 久久激情综合网| 91久久精品一区二区三| 2017欧美狠狠色| 一区二区在线观看免费| 国产精品亚洲综合一区在线观看| 欧美日韩一区在线| 成人一区二区三区中文字幕| 欧美丰满高潮xxxx喷水动漫| 国产精品久久毛片av大全日韩| 裸体在线国模精品偷拍| 欧美在线视频日韩| 综合色中文字幕| 粉嫩高潮美女一区二区三区 | 国产91富婆露脸刺激对白| 91精品国产综合久久精品图片 | 亚洲天堂av一区| 国产成人综合精品三级| 日韩欧美视频一区| 日韩福利电影在线| 欧美综合视频在线观看| 日韩美女精品在线| 国产99久久久久| 亚洲精品一区二区三区99| 日韩成人免费看| 欧美日韩不卡视频| 亚洲国产aⅴ天堂久久| 91在线观看美女| 国产精品区一区二区三| 国产成人精品亚洲午夜麻豆| 精品捆绑美女sm三区| 日产国产欧美视频一区精品| 欧美色图一区二区三区| 亚洲激情av在线| 91丝袜高跟美女视频| 国产精品久久久久一区二区三区| 国产成人欧美日韩在线电影| 久久久美女毛片| 国产成+人+日韩+欧美+亚洲| 久久久精品国产99久久精品芒果| 极品少妇xxxx精品少妇| 久久你懂得1024| 成人综合激情网| 亚洲三级免费观看| 色偷偷88欧美精品久久久| 亚洲美女免费视频| 在线观看网站黄不卡| 亚洲二区在线视频| 欧美精品久久99久久在免费线| 视频一区中文字幕国产| 欧美久久婷婷综合色| 亚洲v日本v欧美v久久精品| 911精品国产一区二区在线| 日韩av不卡在线观看| 久久久久久**毛片大全| 成人禁用看黄a在线| 一区二区视频免费在线观看| 欧美日韩免费视频| 免费三级欧美电影| 久久久久久一级片| 成人app网站| 亚洲午夜一区二区三区| 日韩精品一区二区三区四区| 国产精品一区不卡| 亚洲男人电影天堂| 91精品国产色综合久久不卡电影| 久久精品国内一区二区三区| 久久精品男人天堂av| 99视频在线精品| 日韩中文字幕91| 久久九九久精品国产免费直播| 国产精品色一区二区三区| 91视视频在线观看入口直接观看www| 亚洲一区二区在线免费看| 日韩欧美视频一区| 丁香激情综合国产| 亚洲成人av在线电影| 精品国产91洋老外米糕| 色激情天天射综合网| 美女视频黄 久久| 国产精品九色蝌蚪自拍| 欧美性欧美巨大黑白大战| 麻豆成人91精品二区三区| 中文字幕不卡的av| 欧美日韩aaaaa| 成人免费高清在线观看| 亚洲高清不卡在线观看| 欧美国产一区视频在线观看| 欧美喷水一区二区| 岛国精品在线播放| 奇米精品一区二区三区在线观看一| 国产拍欧美日韩视频二区| 日本大香伊一区二区三区| 精彩视频一区二区三区| 夜夜嗨av一区二区三区网页 | 99re这里只有精品首页| 免费成人性网站| 亚洲激情一二三区| 国产欧美一区二区精品婷婷| 欧美日韩不卡一区| 91捆绑美女网站| 国产综合久久久久久鬼色| 天天综合色天天| 亚洲欧美偷拍另类a∨色屁股| 精品国产123| 欧美丰满美乳xxx高潮www| 一本大道久久a久久精品综合|