Cheetah mfc--cfile Family Introduction ADO Connection database open database close database connection string

Source: Internet
Author: User
Tags ole




ODBC is the oldest, but it is still in use today. Occasionally used. DAO and RDO are old interfaces. OLE db new, complex Microsoft out of ADO. VC + + ADO is the mainstream: both MySQL and Oracle have dedicated interfaces. The ADO underlying is an OLE DB implementation. ADO is a COM component.

ADO Private Folders:

To open the StdAfx.h header file with MsADO15.dll:Import the library:

Initialize ADO when initializing an instance: Here are the COM programming requirements:


COM is used extensively inside Windows. Exception handling:
Then the entire project will be able to use ADO.



Open the dialog box:

Define two pointers in a header file: _connectionptr is defined in ADO.

Connect to the database first:
Select the first 1000 lines:

Connection error, check know, did not write the name of the server. The following check is the name of the server:

Place the Create connection part in the constructor:
To here:
The original location after clipping is:

To turn off the handling of the connection button: double-click:

Here's how to open an Access database:
Copy Open Sqlde Code:
To modify the code:
The following modifies the link string that connects Access data:
String connecting acess data: ADO is a generic database that can be used to manipulate any kind of database: Copy the code that shuts down SQL Sever.

Here's an easy way to get a link string: Just create a new text file, modify the name with the extension UDL:
Then double-click:

Choose:
Select Server Name:
Paste here:

Then open Notepad and drag the UDL file to Notepad to open:

Then copy into the code ': Add a slash:

Now link acess database:
Drag the UDL file to Notepad to open: You can get the file:
Plus a slash for C + + recognition \

From for notes (Wiz)

Cheetah mfc--cfile Family Introduction ADO Connection database open database close database connection string


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.