Using Visual C++, which technique give the fastest performance when reading from SQL Server?

2026-07-02T06:04:31.4533333+00:00

There are a number of techniques (products) that allow an application written in Visual C++ to read (and write data) from SQL Server (application and SQL Server on the same server). For example, ADO, OLE-DB, ODBC, ADO.NET etc

WHich of these techniques gives the best performance (perhaps is the most efficcient in extracting data from sql, and provding to C++)?

Developer technologies | C++
Developer technologies | C++

A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.

0 comments No comments

2 answers

Sort by: Most helpful
  1. Senthil kumar 1,280 Reputation points
    2026-07-02T07:32:22.6266667+00:00

    Hi @Marsh, Christopher (Chris.Marsh@yokogawa.com)

    1. ODBC (Native C API) — fastest, lowest overhead
    2. OLE DB — very fast, COM‑based, slightly heavier
    3. ADO (Classic) — wrapper over OLE DB, slower
    4. ADO.NET — managed code, slower for C++ native apps

    this is my ranking.

    Thanks.

    Was this answer helpful?

    0 comments No comments

  2. Nancy Vo (WICLOUD CORPORATION) 6,595 Reputation points Microsoft External Staff Moderator
    2026-07-02T06:27:16.4866667+00:00

    Hello @Marsh, Christopher (Chris.Marsh@yokogawa.com) ,

    Thanks for your question.

    I recommend using ODBC, specifically the Microsoft ODBC Driver for SQL Serve.

    • ODBC and OLE-DB: These are low-level, native C++ APIs. They talk directly to the database with no middlemen, making them the fastest options. Microsoft officially recommends ODBC as the standard for native C++ data access.
    • ADO: This is a high-level wrapper built on top of OLE-DB to make coding easier. Because it adds an extra layer of translation, it will always be slower than using OLE-DB or ODBC directly.
    • ADO.NET: This is designed for .NET languages like C#. Using it in native Visual C++ requires translating data between "unmanaged" native code and "managed" .NET code, which hurts performance.

    Because your C++ app and SQL Server are on the exact same server, your biggest performance gain will come from the connection protocol. You should configure your connection string to use the Shared Memory protocol. This bypasses the network completely and moves data directly through the computer's RAM, which may be the fastest possible method.

    I hope this addresses your question. If this response was helpful, please consider following the guidance to provide feedback.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.