zoukankan      html  css  js  c++  java
  • 数据库 封装类CppSQLite3的helloword VC6

    虽然昨天花了一天时间搞定了sqlite的C接口,想着今天应该很快就能搞定CppSQLite3,不过BUG这个东西...真的不好说,一直折腾到下午五点半,期间有段时间非常烦躁,连话都不想说了,莫名其妙的bug,明明看着没问题。最后总算是弄出来了,过程略,简要记录下步骤,方便以后使用。

     CppSQLite3U是一个封装好的MFC可以使用的操作sqlite3的类。

    注:需要提前按sqlite并配置环境。

    1.需要的文件5个:

    CppSQLite3.cpp

    CppSQLite3.h

    sqlite3.h

    sqlite3.lib

    sqlite3.dll

    下载地址:http://download.csdn.net/detail/stan1989/5071045

    2.Project -> Settings -> Link -> 将sqlite3.lib添加进Object/library

    3.将CppSQLite3.h 和CppSQLite3.cpp添加到工程中

    4.在程序中添加#include "CppSQLite3.h"

    5.使用

    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 ",query.getStringField("id"),
    query.getStringField("name"),
    query.getStringField("age"));
    query.nextRow();
    }
    query.finalize();
    db.close();
    return 0;
    }

    即可,其他详细使用参考其他教程。

  • 相关阅读:
    【转载】Myeclipse如何自动创建hibernate
    win7 64位mysql安装及navicat 解压版
    NuGet套件还原步骤(以vs2012为例)
    Html.DropDownListFor() 二级联动 ($.getJSON)
    ModelState验证部分属性
    asp.net mvc发送邮件
    SpringBoot的热部署
    SpringBoot 入门demo
    集群、负载均衡、微服务、分布式的概念
    SpringBoot 简介
  • 原文地址:https://www.cnblogs.com/vipwtl/p/5920746.html
Copyright © 2011-2022 走看看