Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hello ,

I want connect C++ to Database for Bank project.

can you help me ? thank's.
Posted
Comments
Sergey Alexandrovich Kryukov 29-Dec-14 15:49pm    
Your platform? Libraries you are using, any relevant detail?
—SA
PIEBALDconsult 29-Dec-14 15:54pm    
Please use Improve question to add detail and context.
RedDk 29-Dec-14 16:09pm    
Hi Dana,

There's stuff right here at CP that will target both C++ and database:
http://www.codeproject.com/Articles/2659/ADO-NET-Primer-using-Managed-C

I think all the code that would normally be zipped up and added in a link at the top of the page is actually contained in the body of the article, so you're good to go ...

1 solution

I have used "A set of ADO classes - version 2.20[^]" together with "ADO Connection Strings[^]" with great success. These classes use MFC and you have to tweak the #import definitions at the top of the ado2.h file to suit your setup. This is my tweak using VS8 on windows 7:
#pragma warning (push, 3)
#pragma warning (disable: 4146)
// CG : In order to use this code against a different version of ADO, the appropriate
// ADO library needs to be used in the #import statement
//#pragma message ("Make sure you go to Tools.Options.Directories.Library files and add the paths to msado15.dll and msjro.dll will usually be in C:\\Program Files\\Common Files\\System\\ado")

// See http://www.codeproject.com/Messages/4356377/Broken-ADO-when-compiling-at-Windows-SP.aspx
#import "C:\Program Files (x86)\Common Files\System\ado\msado28.tlb" rename("EOF", "EndOfFile")
#import "C:\Program Files (x86)\Common Files\System\ado\MSJRO.DLL" no_namespace rename("ReplicaTypeEnum", "_ReplicaTypeEnum") 

//#import <msado15.dll> rename("EOF", "EndOfFile")
//#import <msjro.dll> no_namespace rename("ReplicaTypeEnum", "_ReplicaTypeEnum") 

using namespace ADODB
Maybe not the most portable solution, but it works for my setup.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900