Posted by Rahman M On Friday, August 10, 20123comments
Thereare manyDelphicomponents thatcanbe usedtointeractwithsqlite, one of the mostpopularis theZEOS. It can be usedforsqlite, ZEOSalso be used tointeractwithsome of thebigserverslikeOracle, MySQL, PostgreSQLand many more.
downloadfirstsqlite3.dllhere and place it onthe mainprojectfolder.
you can download thelatestversionof ZEOS here. I assumeyou've installedZEOSindelphi. hereI amusingDelphi2009. Now openyourDelphiandcreate a new projectandaddcomponentsZEOS, TZConnectionandTZQuery like this picture below.
double-click on theeventonActivateForm1 and insertthe followingcode.
procedure TForm1.FormActivate(Sender: TObject); begin ZConnection1.Protocol:='sqlite-3'; ZConnection1.Database:=ExtractFilePath(Application.ExeName) + '\coba.sdb'; ZConnection1.Connect;
//check connection if ZConnection1.Connected=true then begin Application.MessageBox('connection successfully done','Checking connection',MB_ICONINFORMATION); end else Application.MessageBox('connection failed','Checking connection',MB_ICONSTOP); end;