About Apex InfoTech Information Services Products Consulting Online Courses Certifications Course Schedule Reserve your seat Search Apex InfoTech Home Page
Course ScheduleSearch by Course NumberPrint this documentEmail this documentRegister for this course

Accessing Data With Microsoft Visual C++ 6

Course 1595: Three days; Instructor-led

Introduction

This 3-day workshop will teach Microsoft® Visual C++™ programmers to use Microsoft technologies such as Microsoft ActiveX® Data Objects (ADO), OLE DB templates, and Microsoft Foundation Class Open Database Connectivity (MFC ODBC) classes, to build applications and components that access data sources.

At Course Completion

At the end of the course, students will be able to:

  • Identify the most appropriate data access technology to be used in developing different types of applications and components.
  • Build MFC Client applications that access data from a relational database management system (RDBMS) by using Open Database Connectivity (ODBC).
  • Build client applications and components that access data from a data source by using the CAccessor, CDynamicAccessor, and CManualAccessor template classes of OLE DB.
  • Build client applications and components that access data from a data source by using ADO.

Microsoft Certified Professional Exams

This course will help the student prepare for the following Microsoft Certified Professional exam:

  • Exam 70-015, Designing and Implementing Distributed Applications with Microsoft Visual C++ 6.0
  • Exam 70-016, Designing and Implementing Desktop Applications with Microsoft Visual C++ 6.0

Prerequisites

This course assumes that the student has intermediate programming competency with the Visual C++ product. Before attending this course, students must be able to demonstrate the following skills:

  • Build and debug COM components that implement dispinterfaces and dual and custom interfaces by using the Active Template Library (ATL) in Microsoft Visual C++.
  • Build applications in MFC by using the Document/View architecture.
  • Use structured query language (SQL) syntax to query, insert, update, and delete information in a database, and understand stored procedures.

Prerequisite Courses:

  • Course 1304, Component Development using the Active Template Library.
  • Course 1011, Mastering MFC Fundamentals Using Microsoft Visual C++.

Recommended Courses:

  • Course 1015, Mastering MFC Development Using Visual C++ 6.
  • Course 833, Implementing a Database on Microsoft SQL Server 7.0.

The course materials, lectures, and lab exercises are in English. To benefit fully from the instruction, students need an understanding of the English language and completion of the prerequisites.

Course Outline

Day 1

Module 1: Data Access Strategies

Topics

Microsoft Strategy for Universal Data Access
Data Access Terminology
Additional References
Review

Skills

Students will be able to:

  • Explain the benefits of Universal Data Access.
  • Explain the role of ODBC, OLE DB, and ADO.
  • Define the terms transaction, cursor, and stored procedure.
  • Differentiate between client-side and server-side cursors.

Module 2: Introduction to ODBC

Topics

ODBC Architecture
Registering an ODBC Data Source
Review

Skills

Students will be able to:

  • Identify the elements of the ODBC Architecture.
  • Register a data source by using the ODBC Administrator.
  • Register a data source by using the ODBC Application Programming Interface (API).

Module 3: Using the MFC ODBC Classes

Topics

MFC ODBC Database Classes
Building MFC ODBC Applications
Adding, Deleting, and Editing Records
Debugging and Error handling
Best Practices
Review

Labs

Calling Stored Procedures
Building a Simple Database Application

Skills

Students will be able to:

  • Describe the role of each MFC ODBC class in the MFC hierarchy.
  • Build a simple MFC application that retrieves data from a table into a recordset.
  • Navigate the records in a recordset by using the CRecordset member functions.
  • Change the default SQL query, set filter conditions, and change the sort order in a recordset.
  • Differentiate between the prepare-execute method and the direct-execute method of executing SQL statements.
  • Execute parameterized queries and stored procedures.
  • Build an ODBC browser application by using the MFC AppWizard.
  • Add, delete, and modify records in a recordset.
  • Add transaction processing to an ODBC application.
  • Use the CDBException class to trap and handle errors.
  • Retrieve diagnostic information by using the SQLGetDiagRec function.

Module 4: Introduction to OLE DB

Topics

Benefits of OLE DB
Types of OLE DB Applications
OLE DB Architecture
OLE DB Physical Architecture
Review

Skills

Students will be able to:

  • List the benefits of using the OLE DB technology for data access.
  • List the types of OLE DB applications.
  • Describe the role of OLE DB components in data access.
  • Describe the OLE DB resource pooling mechanism.
  • Describe the OLE DB physical architecture.

Day 2

Module 5: OLE DB Consumer Templates

Topics

Introduction to OLE DB Templates
Using the Consumer Template Classes
Accessing a Data Source from an MFC Application
Changing a Rowset
Data Links
Review

Labs

Creating an OLE DB Consumer Application
Creating an OLE DB Consumer Component

Skills

Students will be able to:

  • Explain the role of the OLE DB consumer template classes.
  • Use the MFC AppWizard to build applications that retrieve, add, delete, and edit records in a data source by using multiple accessors.
  • Use the Active Template Library (ATL) AppWizard to build components that retrieve and update records in a data source by using the CAccessor class.

Module 6: Executing Dynamic Queries with OLE DB

Topics

Retrieving Schema Information
Retrieving Data Using Dynamic Queries
Handling OLE DB Errors
Review

Labs

Handling Dynamic Queries
Using the CManualAccessor

Skills

Students will be able to:

  • Retrieve database table information by using the CTables class.
  • Retrieve database column information by using the CColumns class.
  • Access a rowset of unknown schema by using the CDynamicAccessor class.
  • Access a rowset of unknown schema by using the CManualAccessor class.
  • Use the GetValue and SetValue methods to edit field values in a rowset.

Module 7: Executing Parameterized Queries with OLE DB

Topics

Using Parameters with a Static Accessor
Using Parameters with a Dynamic Accessor
Using Parameters with a Manual Accessor
OLE DB Best Practices
Review

Labs

Executing Parameterized Queries
Executing Dynamic Parameterized Queries

Skills

Students will be able to:

  • Use parameter map macros to set parameter information and invoke stored procedures.
  • Set parameter information and use the dynamic parameter accessor to retrieve data from a data source, by using a parameterized query.
  • Set parameter information and use the manual accessor to retrieve data from a data source, by using a parameterized query.
  • Describe some best practices when using OLE DB to retrieve data from a data source.

Day 3

Module 8: Introduction to ActiveX Data Objects

Topics

ADO Object Model Overview
Using Data Controls
Review

Skills

Students will be able to:

  • Describe the role of ADO in applications that require database access.
  • Describe the objects in the ADO object model.
  • Use the ADO Data Control and data-bound controls to retrieve data from a data source.

Module 9: Using ActiveX Data Objects

Topics

Establishing a Database Connection
Executing a Command
Creating and Navigating Recordsets
Finding and Filtering Records in a Recordset
Changing a Recordset
Using the Fields Collection
Retrieving Metadata
Review

Labs

Binding Controls and Classes
Entering Data Using ADO

Skills

Students will be able to:

  • Create an ADO Connection object and open a connection to a data source.
  • Create an ADO Command object and execute a command.
  • Create an ADO Recordset object and navigate a recordset.
  • Add, edit, and delete records in a data source.
  • Use the Fields collection to access field content.

Module 10: Parameterized Queries and Error Handling

Topics

Executing Stored Procedures from a Command
Handling Errors
Review

Labs

Passing Parameters to a Stored Procedure
Handling Errors in an ADO Application

Skills

Students will be able to:

  • Call stored procedures and execute SQL parameterized commands by using the Parameters collection.
  • Handle errors by using the Errors collection.

For more information or to give feedback, send e-mail to info@OneApex.com or call 949-597-2100