使用 C++ 连接数据并将其插入到 MS Access 表中
我正在开发一个项目,要求我对 MS Access 表执行插入查询。我一直在网上到处搜索,但似乎没有任何效果。任何帮助将不胜感激。另外,我必须为 VS2008 和 Visual C++ 6.0 编写此内容。谢谢
I am working on a project that requires me to perform insert query on an MS Access table. I have been searching everywhere online but nothing seems to work. Any help would be greatly appreciated. Also, I have to write this for VS2008 and and Visual C++ 6.0. Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用 ODBC 。连接到数据库并执行 INSERT 查询的示例:
来源:https://learn.microsoft.com/en-us/previous-versions/office/developer/office-2007/cc811599(v=office.12)
Use ODBC. Example of connecting to database and executing INSERT query:
Source: https://learn.microsoft.com/en-us/previous-versions/office/developer/office-2007/cc811599(v=office.12)
您有(太多)选择: ADO/ RDO、DAO,ODBC 和 OLE DB,仅举几例。 DAO 已被正式弃用。 ADO/RDO 并不是正式的,但 MS 似乎也不再关心它们了。然而,对于 VC 6,过时几乎是不争的事实。我相信 VS 2008 至少在某种程度上仍然支持它们,但它们不再包含任何帮助使用 DAO 的向导。
这基本上让 OLE DB 和 ODBC 作为您的第一选择。 MS 仍在积极支持和开发它们,其他的无论如何也不可能提供任何重大优势。
我应该补充一点,VC++ 6.0 提供了 VS2008 所缺少的许多功能来编写使用数据库的应用程序。您可能想看看我在 上一个问题以获得一些指导。
You have (far too) many choices: ADO/RDO, DAO, ODBC, and OLE DB, to name only a few. DAO is officially deprecated. ADO/RDO aren't officially, but MS doesn't seem to care much about them anymore either. With VC 6, however, obsolescent is pretty much a fact of life. I believe they're all still supported to at least some degree under VS 2008, but they no longer, for example, include any wizards to help with using DAO.
That basically leaves OLE DB and ODBC as your first couple of choices. MS is still actively supporting and developing them, and the others are unlikely to provide any major advantage anyway.
I should add that VC++ 6.0 provides quite a few features missing from VS2008 for writing applications that use databases. You might want to look at what I showed in a previous question for some guidance.