Use C ++ code to create and compress ACCESS Database Files

Source: Internet
Author: User
Welcome to the CC ++ programming community forum, and interact with 2 million technical staff to enter 2) compress *. MDB files. # Includeadojet. hstaticconstTCHARszSrc [] _ T (ProviderMicrosoft. Jet. OLEDB.4.0;) _ T (performancec: \ TEST1.MDB;); _ T (JetOLEDB: EngineType5; JetOLEDB: D

Welcome to the C/C ++ programming community forum to interact with 2 million technical staff> go to 2) compress *. MDB files. # Include adojet. h static const TCHAR szSrc [] = _ T ("Provider = Microsoft. jet. OLEDB.4.0; ") _ T (" Data Source = C: \ TEST1.MDB; "); // _ T (" Jet OLEDB: Engine Type = 5; Jet OLEDB: D

Welcome to the C/C ++ programming Community Forum and interact with 2 million technical staff> enter

2) compress the *. MDB file.

# Include

Static const TCHAR szSrc [] =

_ T ("Provider = Microsoft. Jet. OLEDB.4.0 ;")

_ T ("Data Source = C: \ TEST1.MDB ;");

// _ T ("Jet OLEDB: Engine Type = 5; Jet OLEDB: Database PassWord = ??? ");

Static const TCHAR szDst [] =

_ T ("Provider = Microsoft. Jet. OLEDB.4.0 ;")

_ T ("Data Source = C: \ TEST2.MDB ;");

// _ T ("Jet OLEDB: Engine Type = 5; Jet OLEDB: Database Password = ??? ");

Jet OLEDB: Engine Type = 5 indicates that the MDB File of ms jet 4x is used. If this attribute is not provided, the system automatically converts the compressed MDB file to the latest version.
CComPtr Engine;

// If (SUCCEEDED (Engine. CoCreateInstance (_ uuidof (JetEngine ))))

If (SUCCEEDED (Engine. CoCreateInstance (L "JRO. JetEngine ")))

{

Engine-> CompactDatabase (CComBSTR (szSrc), CComBSTR (szDst ));

} MS documentation indicates that the JET component is no longer included since MDAC2.6, and MDAC2.7 is the last version of JRO, and JRO cannot be used on WIN64. It looks like M $ is encouraging us to use SQL SERVER.

[1] [2]

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.