delphi操作sqlite3

Delphi SQLite 简明无废话上手指南SQLite下载

http://www.sqlite.org/download.html

SQLite FAQ

http://www.sqlitecn.org/faq.html

SQLite中文论坛

http://sqlite.com.cn/bbs/index.asp

SQLite入门与分析

http://www.cnblogs.com/hustcat/archive/2009/02/12/1389448.html

GUI 管理工具

SQLite Database Browser

http://sqlitebrowser.sourceforge.net/

Delphi控件

ASqlite3 Components

http://www.aducom.com/cms/download.php

简明例程:

数据库连接

ASQLite3DB1.Database := Path+'test.db';

ASQLite3DB1.DriverDLL := Path+'sqlite3.dll';

ASQLite3DB1.Open;

数据集

ASQLite3Query1.Connection := ASQLite3DB1;

ASQLite3Query1.SQL.Text :='select * from MyTable';

ASQLite3Query1.Open;

执行SQL

ASQLite3Query1.Connection := ASQLite3DB1;

ASQLite3Query1.SQL.Text := Format('insert into MyTable(Age,Name)values(%s,''%s'')',

[edtAge.Text,edtName.Text]);

ASQLite3Query1.ExecSQL;

或者

ASQLite3DB1.SQLite3_ExecSQL(Format('update MyTable set Age=Age+1',

[Edit2.Text,Edit1.Text]));

或者

with ASQLite3Query2 do begin

Close;

SQL.Clear;

SQL.Add('insert into animal (id, desc) values (:v1, :v2)');

Params[0].AsString := '99';

Params[1].AsString := 'ninetynine';

ExecSQL;

end;

事务

//开始事务

ASQLite3DB1.StartTransaction;

//提交事务

ASQLite3DB1.Commit;

//回滚事务

ASQLite3DB1.RollBack;

http://www.delphixe.net/2017/07/17/delphi-sqlite-%E7%AE%80%E6%98%8E%E4%B8%8A%E6%89%8B%E6%8C%87%E5%8D%97/