Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the implementation related to effective use of ADO operations

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article is about the effective use of ADO operations related to the implementation is how, the editor feels very practical, so share with you to learn, I hope you can learn something after reading this article, say no more, follow the editor to have a look.

The path name can be set according to the path of the ADO support files installed on your system. When the compiler encounters a # import statement, it generates a wrapper class for the interface in the reference component type library, and the # import statement actually executes the API culvert LoadTypeLib (). The ADO operation statement produces two files in the project executable output directory.

They are * .tlh (type library header file) and * .tli (type library implementation file), which generate smart pointers for each interface, declare various interface methods, enumerated types, CLSID, and so on, and create a series of wrapper methods. The statement no_namespace states that ADO objects do not use namespaces, and rename ("EOF", "adoEOF") states that the closing flag EOF in ADO is changed to adoEOF,ADO operation to avoid naming conflicts with other libraries.

Second, components need to be initialized during the initial process of the program.

You can generally use CoInitialize (NULL);, which closes the initialized COM at the end, using the following statement CoUnInitialize ();. There is another way to initialize COM in MFC, which requires only one statement to automatically initialize the COM and close the ADO operation for us, as shown in the following statement: AfxOleInit ()

Then, you can use the ADO operation directly. We often use only three of the smart pointers declared in the wrapper class .tlh when we referenced the type library with the # import statement, which are _ ConnectionPtr, _ RecordsetPtr, and _ CommandPtr, respectively. The following describes how to use them respectively:

Thinking about the study of ADO MoveNext scanning

Introduction to transferring ADO recordsets using applications

How to set ADO.NET Data Service permission description

ADO.NET database programming is described in detail.

Detailed explanation of ADO.NET database programming skills and instructions

ConnectionPtr smart pointer, usually used to open or close a library connection, or to use its Execute method to execute a command statement that does not return results (usage is similar to the Execute method in _ CommandPtr).

-- Open a library connection. First create an instance pointer, then open a library connection with Open, which will return a pointer to the automation interface of IUnknown. The code is as follows:

In the toolbox, there are new controls-DataGridView, DataConnector and DataNavigator. With these controls, you can provide data navigation (paging) functionality in data-bound controls. The DbProvidersFactories class provides a list of existing data providers (providers) on the current machine. When writing database dependencies, the ADO operation allows you to use this class and its members to find the most suitable data provider for your database.

Custom data providers (Provider) now extend support for custom data providers by providing factory classes for ADO operations. You don't need to write a data provider support code. You can use the data provider base class and connection string to help you with these functions.

The above is the effective use of ADO operations related to the implementation is how, the editor believes that there are some knowledge points may be seen or used in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report