Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Mọi thứ đều đã hoàn tất cho bối cảnh pop-up để làm việc. Nếu bạn xây dựng Sketcher, bạn có thể chọn các loại thành phần và màu sắc từ một menu ngữ cảnh, Bạn cần phải thêm tất cả các chức năng bạn đã thấy trước đó để lớp CBox. Trước đây, bạn đã định nghĩa một số thành viên chức năng trong định nghĩa lớp | Chapter 19 your recordset object accesses a record. If the data in the current record is modified by another user this is not apparent in your recordset object unless you move to another record and then return to the original record. A dynaset recordset uses an index to the database tables involved to generate the contents of each record dynamically. Because you have no other users accessing the Northwind database you can choose the Snapshot option for your example. After Snapshot has been chosen you can click the Generated Classes option to display the classes in your application. The dialog box is shown in Figure 19-13. Figure 19-13 Here you can change the class names and the corresponding file names assigned by the wizard to something more suitable if you want. In addition to the changes shown for the CDBSampleView and CProductView classes and the corresponding changes to the names of the .h and .cpp files for the class you could also change the CDBSampleSet class name to CProductSet and the associated .h and .cpp file names to be consistent with the class name. After that is done click Finish and generate the project. Understanding the Program Structure The basic structure of the program is as you have seen before with an Application Class CDBSampleApp a Frame Window Class CMainFrame a Document Class CDBSampleDoc and a view class CProductView. A document template object is responsible for creating and relating the frame window document and view objects. This is done in a standard manner in the InitInstance member of the application object. The document class is standard except that the MFC Application wizard has added a data member m_DBSampleSet which is an object of the CProductSet class type. As a consequence a recordset object is automatically created when the document object is created in the InitInstance function member of the application object. The significant departures from a non-database program arise in the detail of the CRecordset class and in the .