C 使用sqlite的方法

2021-07-14 02:09:04 字數 1294 閱讀 9618

windows下sqlite的使用

2.編譯生成lib檔案

 將sqlite3.h(在sqlite-amalgamation-3071300.zip壓縮包中)新增到工程。

sqlite3.lib複製到工程資料夾下。

工程屬性中新增sqlite3.lib庫依賴。

3.建立win32工程

**如下:

/* 

本程式測試sqlite資料庫的增刪改查

*/

#include "stdafx.h"

#include "sqlite3.h"

#include using namespace std;

sqlite3 * pdb = null;

//增加使用者

bool adduser(const string& sname, const string& sage);

//刪除使用者

bool deleteuser(const string& sname);

//修改使用者

bool modifyuser(const string& sname, const string& sage);

//查詢使用者

bool selectuser();

int _tmain(int argc, _tchar* argv)

{ //開啟路徑採用utf-8編碼

//如果路徑中包含中文,需要進行編碼轉換

int nres = sqlite3_open("d:\\sqlite\\test.db", &pdb);

if (nres != sqlite_ok)

{ cout<<"open database fail: "《執行結果:

add user success: zhao 18

add user success: qian 19

add user success: sun 20

add user success: li 21

delete user success: zhao

modify user success: sun 15

id = 2, name = qian, age = 19,

id = 3, name = sun, age = 15,

id = 4, name = li, age = 21,

sqlite 的使用方法

移動開發常用 sqlite資料庫 特點 足夠小,足夠快 本地資料庫 使用比較簡單 增刪改查 sql語句 常用軟體 mesasqlite資料庫操作軟體 資料庫操作語言 sql 結構化查詢語言 常用開源庫 fmdb sqlite 是乙個輕量級的關聯式資料庫。ios sdk很早就支援了 sqlite,在使...

SQLite加密的方法(c )

設定下密碼就可以了 編譯為靜態庫,並具備加密功能?cppsqlite3u 最近在做乙個winform的程式,考慮用sqlite的資料庫,小巧而實用,比access強多了,不過需要加密,不過free版本沒有實現加密,有一些c 的實現 比如 和 不過,鑑於我對c 不是很精通,於是就採用了ado.net ...

SQLite使用方法

sqlite是嵌入在android系統中的輕量級資料庫,下面讓我通過 檢視如何使用sqlite語句去運算元據庫。package com.music.utils import android.content.contentvalues import android.content.context im...