C ++连接到MS SQL DB [英] C++ connect to a MS SQL DB

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

问题描述

嘿伙计们,



为了我的工作,我需要用数据库制作程序。

有人可以告诉我如何连接我的MS SQL 2008 Express数据库到我的c ++ 2008程序?



请帮助我。

Hey guys,

Fore my work I need to make a program with a database.
Can somebody tell me how I connect my MS SQL 2008 Express database to my program in c++ 2008?

Please help me.

推荐答案

例如,请参阅:在C / C ++中连接/使用SQL服务器? [ ^ ]。
See , for instance here: "Connect / use SQL server in C/C++?"[^].


有一个看这里:

如何:创建一个SQL Server Project(C ++) [ ^ ]

SQL Server连接 [ ^ ]
Have a look here:
How to: Create a SQL Server Project (C++)[^]
SQL Server Connectivity[^]


至少有两种方法可以连接到Windows上的大多数数据库

*通过连接一个原生的文化图书馆。大多数(许多)数据库引擎附带了一个功能库,C / C ++程序可以链接到这些功能库以便使用数据库。我没有太多这方面的经验,但是你会期望这样的程序具有速度优势,因为它使用本机代码但它也会锁定在1个数据库引擎中。



* ODBC - (Open DataBase Conectivity)这允许用户设置数据源,数据源不限于特定的数据库引擎。然后,程序链接并调用ODBC API(OBDC引用),ODBC层建立连接并为用户提供标准化的SQL语法,然后将其解释为数据源的特定SQL方言。应用程序没有锁定到单个数据库引擎,但确实有一层额外的代码,因此可能会有速度损失。



请查看以下链接:



1)如何:创建SQL Server项目(C ++): http://msdn.microsoft.com/en-us/library/ktheed7h%28v=vs.90%29.aspx



2)如何使用Qt连接ms sql server 2008 EXPRESS:

http://www.qtcentre.org/threads/29518-How-to-connect-to-ms- sql-server-2008-EXPRESS%EF%BC%9F



3)使用SQL Native Client构建应用程序:

http://msdn.microsoft.com/en-us/library/ms130904% 28SQL.90%29.aspx



4)连接到MSSQL Server Express的最小代码d使用Visual C ++ Express提取一些表数据:

http://stackoverflow.com/questions/7777953/minimal-code-to-connect-to-mssql-server-express-and-extract-some-table- data-usin



问候,

Alex。
There are at least 2 ways to connect to most databases on Windows
* Connection through a native propitiatory library. Most (many) database engines ship with a library of functyions that a C/C++ program can link to in order to use the database. I don't have much experience of this, but you would expect such a program to have a speed advantage because it uses native code but it would also be locked into 1 database engine.

* ODBC - (Open DataBase Conectivity) this allows the user to set up a data source, the data source is not restricted to a particular database engine. The program then links to and makes calls to the ODBC API (OBDC reference) the ODBC lay makes the connection and provides a standardised SQL syntax for the user that it then interprets into the specific SQL dialect of the data source. The application is not locked to a single database engine but does have an extra layer of code so is likely to have a speed penalty.

Please look the following links:

1) How to: Create a SQL Server Project (C++): http://msdn.microsoft.com/en-us/library/ktheed7h%28v=vs.90%29.aspx

2) How to connect to ms sql server 2008 EXPRESS with Qt:
http://www.qtcentre.org/threads/29518-How-to-connect-to-ms-sql-server-2008-EXPRESS%EF%BC%9F

3) Building Applications with SQL Native Client:
http://msdn.microsoft.com/en-us/library/ms130904%28SQL.90%29.aspx

4) Minimal code to connect to MSSQL Server Express and extract some table data using Visual C++ Express:
http://stackoverflow.com/questions/7777953/minimal-code-to-connect-to-mssql-server-express-and-extract-some-table-data-usin

Regards,
Alex.


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

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