Straight forward sqlite database lazarus / 63-Database ---------------------------------------------------------------------- vdijken · 2021-11-09 10:08 I want to use a simple pascal/lazarus program using an sqlite database without using an IDE, forms etc. One of the tables has so much entries that it does not fit into an array and I need to search into it. But I cannot find an example how to simply open a database, write and read to it and close it without using IDE elements. ---------------------------------------------------------------------- Handoko · 2021-11-09 10:55 Maybe this can help: https://wiki.freepascal.org/SqlDBHowto ---------------------------------------------------------------------- Zvoni · 2021-11-09 11:14 Place the sqlite3.dll in the Project-Folder Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program project1; Uses sysutils, classes, sqldb, db, sqlite3conn; Var  SQLiteConn:TSQLite3Connection;  Transaction:TSQLTransaction;  SQLQuery:TSQLQuery; Const  SQLCreate:String='CREATE TABLE IF NOT EXISTS `tbl_data` (`ID` INTEGER NOT NULL UNIQUE, `StringData` TEXT, PRIMARY KEY(`ID`))';  SQLInsert:String='INSERT INTO tbl_data (StringData) VALUES (:ParamData);';  SQLSelect:String='SELECT * FROM tbl_data WHERE ID=1;'; begin  SQLiteConn:=TSQLite3Connection.Create(nil);  SQLiteConn.DatabaseName:=GetCurrentDir+'/test.db';  Transaction:=TSQLTransaction.Create(SQLiteConn);  Transaction.DataBase:=SQLiteConn;  SQLQuery:=TSQLQuery.Create(nil);  SQLQuery.DataBase:=SQLiteConn;  SQLQuery.Transaction:=Transaction;  SQLiteConn.Open;   SQLQuery.SQL.Text:=SQLCreate;  SQLQuery.ExecSQL;  Transaction.Commit;   SQLQuery.SQL.Text:=SQLInsert;  SQLQuery.ParamByName('ParamData').AsString := 'My TestString';  SQLQuery.ExecSQL;  Transaction.Commit;   SQLQuery.SQL.Text:=SQLSelect;  SQLQuery.Open;   Writeln('StringData for ID=',SQLQuery.FieldByName('ID').AsString,': ', SQLQuery.FieldByName('StringData').AsString);   SQLQuery.Close;  SQLQuery.Free;  Transaction.Free;  SQLiteConn.Free; end. ---------------------------------------------------------------------- JanRoza · 2021-11-09 13:36 Or study this demo project which I once wrote for a Dutch computer magazine. There are some things in it I might do differently today but it shows you a lot of the possibilities in working with SQLite. ---------------------------------------------------------------------- cdbc · 2021-11-09 18:50 Hi Maybe this can be of use....: https://github.com/cdbc- dk/bc_rtl/blob/master/bc_litedb.pas Regards Benny