unit Unit_Hauptformular;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Menus, IniFiles, ZConnection;
const
INICONNECTIONDATA = '
Connectiondata';
INI_Hostname = '
Hostname';
INI_Port = '
Port';
INI_User = '
User';
INI_Password = '
Password';
INI_Database = '
Database';
type
TForm_Hauptformular =
class(TForm)
MainMenu1: TMainMenu;
Datei1: TMenuItem;
Beenden1: TMenuItem;
Hilfe1: TMenuItem;
Info1: TMenuItem;
ZConnection1: TZConnection;
procedure FormCreate(Sender: TObject);
procedure Beenden1Click(Sender: TObject);
private
IniFile :TIniFile;
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form_Hauptformular: TForm_Hauptformular;
implementation
{$R *.dfm}
procedure TForm_Hauptformular.FormCreate(Sender: TObject);
var
a,b,c,d,e:
String;
begin
IniFile := TIniFile.Create(ChangeFileExt(Application.ExeName, '
.ini'));
with IniFile
do
begin
a := ReadString(INICONNECTIONDATA, INI_Hostname, '
localhost');
b := ReadString(INICONNECTIONDATA, INI_Port, '
3306');
c := ReadString(INICONNECTIONDATA, INI_User, '
SYSDBA');
d := ReadString(INICONNECTIONDATA, INI_Password, '
masterkey');
e := ReadString(INICONNECTIONDATA, INI_Database, '
AP_v4');
end;
IniFile.Free;
try
with ZConnection1
do
begin
HostName := INI_Hostname;
Port := StrToInt(INI_Port);
User := INI_User;
Password := INI_Password;
Database := INI_Database;
Connect;
end;
ShowMessage('
Verbindung erfolgreich!');
except
ShowMessage('
Verbindung fehlgeschlagen!');
end;
end;
procedure TForm_Hauptformular.Beenden1Click(Sender: TObject);
begin
close;
end;
end.