Introduction to Windows Database programming interfaces

Source: Internet
Author: User
Tags odbc ole

A database is a system dedicated to managing data resources in a computer, and almost all of the software currently needs to deal with the database (including the operating system, such as the registry on Windows is actually a database). Some of the software is based on the database as a core so it is very important for programmers to master the use of database system and how to use the programming interface of database system. So I spent a certain amount of time learning how to manipulate a database on a Windows platform using a COM interface. This time I will learn the knowledge of the process and some of the pits are published for personal reference, but also for the convenience of others to learn

The most common DBMS now are Oracle, Sybase, Informix, DB2, SQL Server, Access, Visual Foxpro, and MYSQL. Since I am mainly learning the programming skills on the Windows platform, the content of this series will be based on the Windows platform, so the database chooses SQL Server, the programming interface is mainly ADO and oeldb.

Common database programming components for Windows platforms

Currently, the main use of the Windows platform is ODBC, DAO, RDO, ADO, Cloud, OLE DB.
Other database programming interfaces because of the Microsoft deprecated or the number of users, and so on reasons I do not care about them, the main learning is OLE DB and ADO programming. Since ADO is a encapsulated ActiveX control for OLE DB, mastering OLE DB makes it difficult to learn ado, so I will focus on OLE DB, and for ADO it will only be simple steps.

Basic concepts of OLE DB
    1. Data providers and data consumers: the software on both ends of the interface in OLE DB is referred to as the data provider (usually the end of the database, which focuses on the organization of the data) and the data consumer (the end of the application, with emphasis on the presentation and use of database data). OELDB is a programming interface for both ends, which prepares a set of interfaces for both the data provider and the consumer, and the data provider implements a number of interfaces that are used to output data from the database to the application or to complete the operation of the data according to the instructions of the application, while the data consumer mainly uses the programming interfaces provided in it. To achieve data acquisition or update operations. (I think the relationship between them is like a standard COM interface, a responsible invocation, a responsible implementation) in essence, OLE DB is a standard data interchange interface between database and application system, and its benefits are efficient, versatile and flexible.
    2. Data sources: In general, data sources can be understood as data providers or as individual DBMS, but in ADO, the data source can be a text file, Excel, or an XML file
MSDAC Introduction

MSDAC (Microsoft Data Access Components) Microsoft Database Access component, currently MSDAC mainly has ADO, OLE DB, ODBC
The full MSDAC Help documentation is available on MSDN in Windows, and in MSDN, select "Directory"-"Win32 and COM Development"-"data Access and Storage"-"Windows data Access Components SDK. Its underlying directory is the detailed documentation of the various components, the overall structure of which is as follows:

The basic idea of OLE DB programming

The basic steps for OLE DB programming are as follows:

    1. First, create the data source object, specify the related properties of the linked database, link to the database
    2. Then create the Session object
    3. To create a command object from a Reply object
    4. Executes the SQL statement using the command object and returns the result set object
    5. Reads the data from the result set object and outputs
    6. Finally close all object interfaces and close the database connection
      These things will be described in detail in the following sections, this blog post is only open.

Introduction to Windows Database programming interfaces

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.