如何在C +程序中使用数据库? [英] How Can I Use A Database In A C+ Program?

查看:136
本文介绍了如何在C +程序中使用数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个c ++程序,它基本上要求用户输入他的用户名和密码。如果用户名和密码与存储在数据库中的用户名和密码匹配,则程序允许用户输入。现在,我将存储相当多的用户名和密码,我不想使用.txt文件作为数据库。我想学习正确的方法,如果我需要存储大量数据,那么我可以使用适当的数据库。我在vb.net中编程时使用了mysql,但我从未使用过cql数据库和c ++。我想在我的c ++程序中使用它。有没有我可以参考的书或任何可以指导我学习理解将mysql /任何其他数据库连接到我的c ++程序的过程所需的步骤的链接。谢谢

**我使用的是Windows操作系统和Visual Studio c ++ **

I want to create a c++ program which basically asks the user to enter his username and password. If the username and password matches with the username and password stored in the database then the program lets the user enter. Now, i will be storing quite a number of usernames and password and i dont want to use a .txt file as a database. I want to learn the proper way such that if i need to store large amount of data then i can use an appropriate database. I have used mysql when i programmed in vb.net but i have never used sql database with c++. I want to use it with my c++ program. Is there a book that i can refer to or any links that can guide me to learn the steps required to understand the process of connecting a mysql/any other database to my c++ program. Thanks
**I am using Windows OS and Visual studio c++**

推荐答案

例如,你可以在这里开始:

http://msdn.microsoft.com/en-us/library/kd4ck1tt。 aspx [ ^ ],

http://dev.mysql.com/doc/connector- cpp / en / index.html [ ^ ]。



您的帖子表明您使用的是Windows,但您没有注明您的平台,您使用的数据库工具,没有。通过这种方法,即使是最好的书也可能不是很有帮助。你需要弄清楚你想要使用什么以及实现什么。



-SA
You can start, for example, here:
http://msdn.microsoft.com/en-us/library/kd4ck1tt.aspx[^],
http://dev.mysql.com/doc/connector-cpp/en/index.html[^].

Your post suggests that you are using Windows, but you did not indicate your platforms, database tools you are using, nothing. With such approach, even the best books may not be very helpful. You need to figure out what exactly do you want to use and what to achieve.

—SA


有很多关于c ++和MySQL(* 1)的书籍 - 虽然最好的是



a)安装MySQL和c ++连接器

b)阅读并处理连接器安装中的样品



就这样做.....



(* 1例如 http://www.booktopia.com.au/managing-using-mysql-randy-jay-yarger/prod9780596002114.html?source=pla&gclid=CjwKEAjwk_OhBRD06abu3qSoxlwSJACt7sZ7rJ1Ls27Iico8FGtErPoQFC7K2Rbw33RUQuxfXJB8txoC_lXw_wcB [ ^ ])



如果你有中等资金,你可以让你的生活更轻松通过购买'devart dotconnect'例如
there are plenty of books out there on c++ and MySQL (*1) - although the best thing is

a) install MySQL and the c++ connector
b) read and work through the samples from the connector install

just do it .....

(*1 eg http://www.booktopia.com.au/managing-using-mysql-randy-jay-yarger/prod9780596002114.html?source=pla&gclid=CjwKEAjwk_OhBRD06abu3qSoxlwSJACt7sZ7rJ1Ls27Iico8FGtErPoQFC7K2Rbw33RUQuxfXJB8txoC_lXw_wcB[^] )

If you have even moderate funds, you can make your life easier by purchasing 'devart dotconnect' for example


这篇关于如何在C +程序中使用数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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