download first sqlite3.dll here and place it on the main project folder.
you can download the latest version of ZEOS here.
I assume you've installed ZEOS in delphi. here I am using Delphi 2009.
Now open your Delphi and create a new project and add components ZEOS, TZConnection and TZQuery like this picture below.
double-click on the event onActivate Form1 and insert the following code.
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;
do compile and see if we write code that worked?
yes, it should work like the image below.
in the next post we will add the data and view data in sqlite using the DBGrid.
10 Comments
This comment has been removed by the author.
ReplyDeleteThank you! It works - I tried with my Delphi7.
ReplyDeleteDelphi 2009 it works
ReplyDeleteDitunggu artikel selanjutnya :)
ReplyDeleteNot at all helpful.
ReplyDeleteYou have a query which you do not use. What does this do apart from connect to a database?
Terimakasih Banyak
ReplyDeleteNice Share!
ReplyDeleteWorks for me although there was a bit of messing around with field types before I could actually see and edit some.
ReplyDeleteNote that text = memo in Delphi and String is required to edit strings in a grid.
Jeszcze !!!Przykład otwarcia bazy i upchanie w TABELę GRID///
ReplyDeleteMconslioterfniSpringfield Jane Milligan download
ReplyDeleteprosexuntau