将C ++连接到数据库 [英] connect C++ to Database

查看:163
本文介绍了将C ++连接到数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,



我想将C ++连接到数据库for Bank项目。



你能帮我吗?谢谢。

Hello ,

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

can you help me ? thank's.

推荐答案

我用过一组ADO类 - 版本2.20 [ ^ ]以及 ADO连接字符串 [ ^ ]with with巨大的成功。这些类使用MFC,您必须调整ado2.h文件顶部的#import定义以适合您的设置。这是我在Windows 7上使用VS8的调整:
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.


这篇关于将C ++连接到数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆