使用CppSQLite3访问SQLite数据库
2014年4月9日16:33:59
C代码:
#include <stdlib.h> #include <stdio.h> #include "CppSQLite3.h" #include<iostream> using namespace std; int main() { printf("hello,world!\n"); CppSQLite3DB db; db.open("data.db3"); /*db.execDML("create table test(id int,name char(20));"); db.execDML("insert into test values (1,'xiufeiyang');"); db.execDML("insert into test values (2,'lixueliang');");*/ CppSQLite3Query query = db.execQuery("select * from test"); while(!query.eof()) { cout<<"id:"<<query.getIntField("id")<<" name:"<<query.getStringField("name")<<endl; query.nextRow(); } query.finalize(); db.close(); system("pause"); return 0; }