如何使用odbc通过c++将excel文件导入到mysql表中?
我有一个 C++ 程序,我计划使用 odbc 将我的 C++ 程序与 mysql 表进行通信。
网上有很多关于如何使用c++和odbc访问mysql表的教程,但是如何使用c++和odbc将excel文件加载到mysql表中?
I have a c++ program, and I am planning to use odbc to communicate my c++ program with mysql tables.
There is alot of tutorials online on how to access mysql tables using c++ and odbc, but how do I use c++ and odbc to load a excel file into mysql tables?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一种方法是将文件保存为 CSV,然后
在程序中执行以下语句。即如果您使用 C++ 包装器,
这应该可以工作。
如果您使用的是 C API,则使用
另一种方法是通过 ODBC 连接连接到 Excel,从那里导入数据并导入到 MySQL。这个就比较复杂了。
One way is to save the file as a CSV and then execute the following statement
in your program. i.e. if you are using the C++ wrapper,
This should work.
If you are using the C APIs then use
The other way to do this would be to connect to Excel via an ODBC connection, import the data from there and import into MySQL. This is more complicated.