unit main;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Menus, ComCtrls, StdCtrls,
DB, ZQuery, ZMySqlQuery, ZConnect,
ZMySqlCon, ZTransact, ZMySqlTr;
type
TForm1 =
class(TForm)
MainMenu1: TMainMenu;
Hilfe1: TMenuItem;
Einstellungen1: TMenuItem;
Zugangsdaten1: TMenuItem;
ListView1: TListView;
StatusBar1: TStatusBar;
Hilfe2: TMenuItem;
N1: TMenuItem;
Info1: TMenuItem;
edName: TEdit;
Label1: TLabel;
edEmail: TEdit;
Label2: TLabel;
edTelefon: TEdit;
Label3: TLabel;
edFax: TEdit;
Label4: TLabel;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
trMain: TZMySqlTransact;
qrMain: TZMySqlQuery;
dsMain: TDataSource;
dbMain: TZMySqlDatabase;
edID: TEdit;
Label5: TLabel;
procedure Button1Click(Sender: TObject);
procedure Connect;
procedure FormClose(Sender: TObject;
var Action: TCloseAction);
procedure Button3Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Connect;
begin
dbMain.Host:='
********';
dbMain.login:='
********';
dbMain.Password:='
********';
dbMain.Database:='
delphi';
dbMain.Connected:=true;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
try
Connect;
qrMain.Sql.Clear;
qrMain.Sql.Add('
INSERT INTO `telebase` (`id`,`name`,`email`,`telefon`,`fax`) ');
qrMain.Sql.Add('
VALUES ');
qrMain.Sql.Add('
(''
''
,''
'+edName.Text+'
''
,''
'+edEmail.Text);
qrMain.Sql.Add('
''
, ''
'+edTelefon.Text+'
''
,''
'+edFax.Text+'
''
);');
qrMain.ExecSql;
finally
if qrMain.Connected=True
then dbMain.Connected:=false;
end;
end;
procedure TForm1.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
if qrMain.Connected=True
then dbMain.Connected:=false;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
try
Connect;
qrMain.Sql.Clear;
qrMain.Sql.Add('
DELETE FROM `telebase` WHERE `id`='+edID.Text+'
;');
qrMain.ExecSql;
finally
if qrMain.Connected=True
then dbMain.Connected:=false;
end;
end;
end.