简体   繁体   English

从C ++进行SQL查询

[英]Making SQL query from C++

I have connected to an MS Access database from my project. 我已从我的项目连接到MS Access数据库。 Now I want to make a query, for example to take out data from third and fourth column. 现在我要进行查询,例如从第三和第四列中取出数据。

How can I write SQL query in C++/CPP, using visual studio 2008? 如何使用Visual Studio 2008在C ++ / CPP中编写SQL查询?

If you're using a framework like MFC, Qt, or wxWidgets, you probably want to use the database connection classes they already include. 如果使用的是MFC,Qt或wxWidgets之类的框架,则可能要使用它们已经包含的数据库连接类。

If you're not using one of those, you probably want to look into another library specifically for the purpose, such as DTL or SOCI . 如果您不使用其中之一,则可能需要专门研究另一个库,例如DTLSOCI

You can obviously write your own code to talk to the database via something like OLE DB or ODBC, but they both involve quite a lot of boiler-plate, so a library helps out a lot . 您显然可以编写自己的代码,以通过OLE DB或ODBC之类的东西与数据库进行通信,但是它们都涉及很多样板,因此库可以提供很多帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM