tags:

views:

527

answers:

4

Hello, 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.

+1  A: 

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

Daniel A. White
A: 

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

linjunhalida
+2  A: 

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.

eran
+1  A: 

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.

toto
that's the better way to do it.that's what i'll do, i'll just use sqlite3.dll directly with the C api.
Attilah