基于mfc对话框的应用程序中的数据库连接 [英] Database connection in mfc dialog based application

查看:61
本文介绍了基于mfc对话框的应用程序中的数据库连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我是vc ++开发人员,我想知道,是否可以使用基于mfc对话框的应用程序连接数据库?如果可能

请给我一些关于它的参考,或者它的一些示例代码。



谢谢

Sibi V J

Hi,
I am a vc++ developer, and I want to know that, is it possible to connect a database with mfc dialog based application? If it possible
Please give me some references about it, or some example codes of it.

Thanks
Sibi V J

推荐答案

是的,这是可能的。

这个 [ ^ ] MSDN 文章是 MFC 数据库编程。 :)
Yes, it is possible.
This[^] MSDN article is a good start point for MFC database programming. :)


这是关于这个主题的初学者文章:使用CDatabase类来读取Access数据库 [ ^ ]
Here's a beginners article on the subject: Using the CDatabase class to read an Access databases[^]


查看 http://www.codeproject.com/KB /cpp/sdba.aspx



我有一个基于MFC对话框的应用程序,但是自从我编写连接部分以来已经很多年了 - 我被告知这就是我使用的混合烤架,它是一个连接的镜像。



这是所有重要的代码:

Have a look at http://www.codeproject.com/KB/cpp/sdba.aspx.

I have an MFC dialog based application but its many years since I wrote the connection part - and I was told that such was the "mixed grill" used by me that it was a miricle that I got a connection.

This was the all important code:
<pre lang="midl">// Connect to the database.
   m_dbHost = _T("localhost");
   m_dbUser = _T("MySampleDB");
   m_dbPassword = _T("MyPassword0;);
   m_dbName = _T("vendatic");
   conn = mysql_init(NULL);
   mysql_real_connect (conn,m_dbHost, m_dbUser, m_dbPassword, m_dbName, 0, NULL, 0 );







我应该能挖出一点点如果需要更多细节。



看看.NET - 如果你刚刚开始,那么就去了。我在做的事情上达到了一个点在.NET中重新开始继续使用MFC更快。组件比COM对象容易得多。




I should be able to dig out a little more detail if needed.

Have a look at .NET - If you are just starting out then its the way to go. I reached a point in what I was doing that it was quicker to start over in .NET that continue with MFC. Assemblies are just so much easier than COM objects.


这篇关于基于mfc对话框的应用程序中的数据库连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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