SQLite with MFC

2019-07-28 05:33发布

I want to use SQLite within my MFC application.

for that, i'll create an object whose job is to interact directly with the DB(SQLite) to insulate the rest of the app from the DB code.

can anyone point me to a good tutorial ? i'll need operations such as (create,delete,insert,update,createdb,dropdb and so on...)

Thanks.

标签: sqlite mfc
4条回答
We Are One
2楼-- · 2019-07-28 06:03

There's a page in the SQLite site that lists many available wrappers - here. The C++ wrapper Daniel mentions in his answer is probably the most common one, though it does not support Unicode and the SQLite dll that comes with it is quite dated. There's a Unicode version of that wrapper here, but it's a bit buggy and requires some more work. It could, however, save you the trouble of writing the whole thing from scratch.

查看更多
Lonely孤独者°
3楼-- · 2019-07-28 06:06

Or you can just do #include "sqlite3.h", add sqlite3.lib to your linker and use sqlite3.dll directly with the C api. That's what I did in my MFC app.

And you can even statically link sqlite3 into your app. Download the amalgamation and include it! It adds about 400 k.

查看更多
姐就是有狂的资本
4楼-- · 2019-07-28 06:13

Please define your problem more clearly. sqlite can be coding with c, and you can read the sample in their site.

查看更多
Emotional °昔
5楼-- · 2019-07-28 06:23

Have a look at this. This was really easy to port to MFC classes, but it will get you started.

http://www.codeproject.com/KB/database/CppSQLite.aspx

查看更多
登录 后发表回答