Data Access in Visual C++


The new home for Visual Studio documentation is Visual Studio 2017 Documentation on

The latest version of this topic can be found at Visual Studio 2017 Documentation. Since 2011 Microsoft has aligned on ODBC as the standard for native applications to connecting to SQL Server databases. For more information, see the FAQ. For modern native C++ applications running on Windows, the preferred way to connect to SQL databases, including SQL Database instances hosted in Azure, is to use the ODBC Driver 11 for SQL Server on Windows.

For low-overhead local database instances, you can use SQL Server 2014 Express LocalDB which does not require an instance of SQL to be running. C++/CLI libraries can use either the native ODBC drivers or ADO.NET as well as Azure data services for .NET. For more information, see Data Access Using ADO.NET (C++/CLI) and Accessing data in Visual Studio.

In This Section

This section covers legacy database programming technologies. These pages are not always relevant for new applications.

Data Access Programming
Describes legacy data access programming with Visual C++, where the preferred way is to use one of the class libraries such as the Active Template Class Library (ATL) or Microsoft Foundation Class (MFC) Library, which simplify working with the database APIs.

OLE DB Programming
Provides links to conceptual topics discussing OLE DB database technology and the OLE DB Template Library.

Open Database Connectivity (ODBC) via MFC
Provides links to conceptual topics discussing targeting ODBC with MFC.

Data-Bound Controls (ADO and RDO)
Discusses a reusable databinding mechanism through ActiveX controls in MFC projects that lets you rapidly develop database applications.

OLE DB Templates
Provides reference material for the OLE DB consumer and provider templates, a set of template classes that implement many commonly used OLE DB interfaces.

MFC Reference
Provides reference material for the MFC Library, a set of classes that constitute an application framework, which is the framework of an application written for the Windows API.

See Also

Data Access Technologies Road Map