Developing Access 2007 Solutions with Native C or C++
Connect to SQL Database using C and C++
Use the article below:
C++ and Microsoft Access Database
1) Create a C++ console app.
2) Copy and paste the code from the article. Delete line 1 #include "stdafx.h"
3) Change the path on line 17 to:
conn = gcnew OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=Northwind.MDB");
4) Copy the northwinds.mdb access database file to the project directory (the one with you .cpp file in it).
5)Change Project Properties->Advanced: set it to "Common Language Runtime Support (/clr)"
6) Project properties C++->Language Conformance mode=no.
4) Copy the northwinds.mdb access database file to the project directory (the one with you .cpp file in it).
5)Change Project Properties->Advanced: set it to "Common Language Runtime Support (/clr)"
6) Project properties C++->Language Conformance mode=no.
Addendum for extra credit:
1) Now create a new MS Access Database file (.accdb).
2) Modify you project to use the new database file.
3) Find the correct sql connection string to use for accdb files.
Enjoy!
1) Now create a new MS Access Database file (.accdb).
2) Modify you project to use the new database file.
3) Find the correct sql connection string to use for accdb files.
Enjoy!
2 comments:
If you are getting an error saying the "Microsoft.ACE.OLEDB.12.0" is not registered on your machine, then you need to install the drivers for the access engine database.
The following is the link to the database drivers (choose 32-bit or 64-bit)
https://www.microsoft.com/en-us/download/details.aspx?id=54920
accdb drivers
Post a Comment