MFC ODBC - 如何创建新的MDB文件? [英] MFC ODBC - How to create new MDB files?
问题描述
大家好:
我正在将C ++应用程序从MFC DAO转换为MFC ODBC。我打开/读取数据库工作得很好,但ODBC没有直观的方法来创建新的数据库。要打开现有的数据库文件,我一直在使用无DSN的连接字符串,
只是将我的文件指定为DBQ。
有没有一种简单的方法可以使用ODBC创建新的无DSN .mdb文件?我没有看到任何迹象表明这是可能的。对SQLConfigDataSource函数的模糊引用暗示了创建一个新的.mdb文件,但这不会创建I
不想要的DSN吗?无论如何,我不完全确定如何访问此功能。
请原谅我的无知,我是Access开发的新手。
谢谢!
特别声明:
创建我们的数据库文件
如果我们动态创建Access文件,我们就不会使用CDaoDatabase :: Open();命令因为Create();自动打开并连接到我们的数据库。
块引用>
Hi all:
I am converting a C++ application from MFC DAO to MFC ODBC. I have the opening/reading of databases working great, but ODBC has no intuitive way to create new databases. To open existing database files, I have been using a DSN-less connection string, just specifying my file as the DBQ.
Is there an easy way to create a new DSN-less .mdb file using ODBC? I haven't seen any indication that this is possible. Vague references to the SQLConfigDataSource function allude to the creation of a new .mdb file, but won't this create the DSN that I don't want? And I'm not entirely sure how to access this function, at any rate.
Please excuse my ignorance, I am new to Access development.
Thanks!
解决方案Have you checked out http://www.codeguru.com/cpp/data/mfc_database/microsoftaccess/article.php/c4311/Retrieving-Writing-and-Creating-Data-in-a-Microsoft-Access-File-CDaoDatabase-and-CDaoRecordset.htm?
Specifically the statement:
Creating Our Database File
If we were dynamically creating an Access file, we wouldn't be using the CDaoDatabase::Open(); command because Create(); automatically opens and connects to the database for us.
这篇关于MFC ODBC - 如何创建新的MDB文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!