procedure TDM.sSql(
Sql :
String);
begin
IBTransaction1.StartTransaction;
IBSQL1.SQL.Clear;
IBSQL1.SQL.Text :=
Sql;
IBSQL1.ExecQuery;
IBTransaction1.Commit;
end;
procedure TDM.F2Anzeige(ID : Integer);
begin
if not Assigned(Form2)
then exit;
if Form2.WindowState = wsMinimized
Then exit;
IBTransaction1.StartTransaction;
IBQuery1.Open;
IBQuery1.Locate('
ID', kunden[id].id, [loCaseInsensitive]);
k_ID := DM.IBQuery1ID.AsInteger;
Form2.JvComboBox1.Text := DM.IBQuery1ANREDE.AsString;
Form2.JvEdit1.Text := DM.IBQuery1VORNAME.AsString;
Form2.JvEdit2.Text := DM.IBQuery1NAME.AsString;
Form2.JvComboBox2.Text := DM.IBQuery1LAND.AsString;
Form2.JvEdit3.Text := DM.IBQuery1PLZ.AsString;
Form2.JvEdit4.Text := DM.IBQuery1ORT.AsString;
Form2.JvEdit5.Text := DM.IBQuery1STRASSE.AsString;
Form2.JvEdit6.Text := DM.IBQuery1TEL.AsString;
Form2.JvEdit7.Text := DM.IBQuery1FAX.AsString;
Form2.JvEdit8.Text := DM.IBQuery1MAIL.AsString;
Form2.JvEdit9.Text := DM.IBQuery1KNR.AsString;
IBQuery1.Close;
IBTransaction1.Rollback;
end;
function TDM.Kundeneu : integer;
begin
IBTransaction1.StartTransaction;
Abfrage.Close;
Abfrage.SQL.Clear;
Abfrage.SQL.Add('
SELECT * FROM KUNDEN ORDER BY CAST(KNR AS INTEGER) ASC');
Abfrage.Open;
Abfrage.Last;
Result := Abfrage.FieldByName('
KNR').AsInteger + 1;
IBTransaction1.Rollback;
end;
procedure TDM.DKunden(
SQL :
String);
var a : integer;
itm : TListItem;
begin
IBTransaction1.StartTransaction;
if SQL <> '
'
Then
begin
IBQuery1.Close;
IBQuery1.SQL.Clear;
IBQuery1.SQL.Add(
sql);
end;
IBQuery1.Open;
SetLength(Kunden, 1);
IBQuery1.First;
While not IBQuery1.Eof
do
begin
setlength(kunden, length(kunden)+1);
a := length(kunden)-1;
kunden[a].id := IBQuery1ID.AsInteger;
kunden[a].knr := IBQuery1KNR.AsInteger;
kunden[a].
name := IBQuery1NAME.AsString;
kunden[a].vorname := IBQuery1VORNAME.AsString;
IBQuery1.Next;
end;
IBQuery1.Close;
IBTransaction1.Rollback;
end;
procedure TDM.AKunden(ListView : TJvListView);
var a : integer;
itm: TListItem;
begin
ListView.Items.Clear;
for a := 1
to Length(kunden)-1
do
begin
itm := ListView.Items.Add;
itm.Caption := IntToStr(kunden[a].id);
itm.SubItems.Add(kunden[a].vorname);
itm.SubItems.Add(kunden[a].
name);
end;
ListView.Items[ListView.Items.Count-1].MakeVisible(True);
if a < 0
then ListView.ItemIndex := ListView.Items.Count-1
else ListView.ItemIndex := a;
F2Anzeige(a);
unit3.KuNr := IntToStr(kunden[a].knr);
unit4.KuNr := IntToStr(kunden[a].knr);
end;