Although yesterday spent a day to fix the C interface of SQLite, think today should be able to fix CppSQLite3, but bug this thing ... Really bad to say, has been tossing to 5:30 P.M., during a period of time very irritable, even words do not want to say, inexplicable bug, obviously look no problem. Finally came out, the process is slightly, briefly record the next step, convenient for later use.
Cppsqlite3u is a well-encapsulated class that MFC can use to manipulate sqlite3.
Note: You need to pre-press SQLite and configure your environment.
1.5 Required Documents:
CppSQLite3U.cpp
CppSQLite3U.h
Sqlite3.h
Sqlite3.lib
Sqlite3.dll
: http://download.csdn.net/detail/stan1989/5071045
Add Sqlite3.lib to Object/library, Link, Settings, 2.Project
3. Add CppSQLite3.h and CppSQLite3.cpp to the project
4. Add # include "CppSQLite3U.h" to the program
5. Use
http://blog.csdn.net/stan1989/article/details/8589293
#include <stdio.h>
#include <stdlib.h>
#include "CppSQLite3.h"
int main ()
{
CPPSQLITE3DB DB;
Remove ("test.db");
Db.open ("test.db");
DB.EXECDML ("CREATE TABLE people (ID int,name char[200],age int);");
DB.EXECDML ("INSERT into people values (1, ' WTL ', 24);");
DB.EXECDML ("INSERT into people values (2, ' zbh ', 23)");
Cppsqlite3query query = Db.execquery ("Select * from people");
while (!query.eof ())
{
printf ("id:%s name:%s age:%s\n", Query.getstringfield ("id"),
Query.getstringfield ("name"),
Query.getstringfield ("Age"));
Query.nextrow ();
}
Query.finalize ();
Db.close ();
return 0;
}
You can use the other tutorials for more detailed reference.
Helloword VC6 of database encapsulation class CppSQLite3