使用CppSQLite3访问SQLite数据库

来源:互联网 发布:演讲培训班有用吗 知乎 编辑:程序博客网 时间:2024/05/20 07:34

使用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;}


0 0
原创粉丝点击