unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, sqlite3conn, sqldb,
db, FileUtil, Forms, Controls,
Graphics, Dialogs, StdCtrls, ExtCtrls, DBGrids, DbCtrls, Calendar, EditBtn,
ComCtrls;
type
{ TForm1 }
TForm1 =
class(TForm)
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Calendar1: TCalendar;
DataSource1: TDataSource;
DBEdit1: TDBEdit;
DBEdit2: TDBEdit;
DBEdit3: TDBEdit;
DBEdit4: TDBEdit;
DBEdit5: TDBEdit;
DBEdit6: TDBEdit;
DBEdit7: TDBEdit;
DBEdit8: TDBEdit;
DBEdit9: TDBEdit;
DBGrid1: TDBGrid;
DBNavigator1: TDBNavigator;
FileNameEdit1: TFileNameEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
OpenDialog1: TOpenDialog;
Panel1: TPanel;
SQLite3Connection1: TSQLite3Connection;
SQLQuery1: TSQLQuery;
SQLTransaction1: TSQLTransaction;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.Button1Click(Sender: TObject);
begin
SQLQuery1.Edit;
SQLQuery1.UpdateMode:=UpWhereChanged;
SQLQuery1.ApplyUpdates;
SQLTransaction1.Commit;
SQLQuery1.Close;
SQLQuery1.Open;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
SQLQuery1.Close;
SQLQuery1.Open;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
close;
end;
procedure TForm1.Button4Click(Sender: TObject);
var
o :
String;
begin
o:=DBEdit1.Text;
FileNameEdit1.Text:='
C:\Users\Jonas\Documents\BUSSE\Adressbuch2\' + o + '
.txt';
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Form1. Caption:='
SQLite database with DBNavigator';
SQLite3Connection1.DatabaseName:='
Adressbook.db';
SQLite3Connection1.Connected:=true;
SQLTransaction1.Database:=SQLite3Connection1;
SQLQuery1.Database:=SQLite3Connection1;
SQLQuery1.SQL.text:='
Select * FROM Adressbook';
SQLQuery1.open;
DataSource1.DataSet:=SQLQuery1;
DBGrid1.DataSource:=DataSource1;
DBNavigator1.DataSource:=DataSource1;
DBEdit1.DataSource:=Datasource1;
DBEdit2.DataSource:=Datasource1;
DBEdit3.DataSource:=Datasource1;
DBEdit4.DataSource:=Datasource1;
DBEdit5.DataSource:=Datasource1;
DBEdit6.DataSource:=Datasource1;
DBEdit7.DataSource:=Datasource1;
DBEdit8.DataSource:=Datasource1;
DBEdit9.DataSource:=Datasource1;
DBEdit1.DataField:='
ID';
DBEdit2.DataField:='
Vorname';
DBEdit3.DataField:='
Nachname';
DBEdit4.DataField:='
Strasse';
DBEdit5.DataField:='
PLZ';
DBEdit6.DataField:='
Ort';
DBEdit7.DataField:='
EMail';
DBEdit8.DataField:='
Telefon';
DBEdit9.DataField:='
Verzeichnis';
DBGrid1.AutoFillColumns:=true;
end;
end.