Go to the official website of SQLite, download source code. http://www.sqlite.org/
After compilation (my Microsoft vs), generate two files: sqlite3.lib and sqlite3.dll.
Create a Win32 project in vs. Copy the sqlite3.h, sqlite3.lib, and sqlite3.dll files to the project directory and delete all the automatically generated code.
Add a CPP file in the project, arwensqlite. cpp, and input the following code:
# Include <string. h>
# Include "sqlite3.h"
# Pragma comment (Lib, ". \ sqlite3.lib ")
Int main (INT argc, char
* Argv [])
{
Sqlite3 * dB;
Int ret;
Char * errmsg = NULL;
Ret = sqlite3_open ("D: \ Temp. DB", & dB); // open the database tmep. DB. If it does not exist, create the file temp. DB.
// Create a table and insert data
Ret = sqlite3_exec (dB, "create table arwentable (name nvarchar (20), age integer)", null, null, & errmsg );
Ret = sqlite3_exec (dB, "insert into arwentable values ('weiwenhp ', 25)", null, null, & errmsg );
Sqlite3_close (db); // close the database
Return 0;
}